Miscellaneous

I use Vim and Linux and You?

This post have some commands, for Vim, Linux, that I have learnt over time. I’ll add more as I learn more.

Vim

  1. :q to quit.
  2. :q! to force quit.
  3. :wq to save and quit.
  4. :wq! force write and quit.
  5. i for insert mode.
  6. v for visual mode.
  7. r to replace the character under the cursor.
  8. cw to replace current word. Cursor should be on it’s first letter.
  9. dw to delete current word under the cursor.
  10. dd to delete current line.
  11. dL to delete all lines on the current screen.
  12. o to begin a new line before the current line.
  13. A to append at the end of the current line.
  14. esc for command mode.
  15. CTRL + F vi page down.
  16. CTRL+B vi page up.
  17. :/<search_string> to search a pattern.
  18. :s/<pattern>/<replace_pattern> to replace first instance of a pattern.
  19. :%s/<pattern>/<replace_with>/g to replace all instances of a pattern.
  20. d to delete.
  21. y to yank.
  22. p to paste.
  23. yy to copy a line.
  24. w to move forward a word.
  25. :<line_number> to go to specific line number.
  26. u to undo n number of changes.
  27. :u to undo one change.
  28. CTRL + R to redo.
  29. :vs or :vsplit to split vim vertically.
  30. ctrl + W  to switch between the splits.
  31. :%s/pattern//gn to count occurrence of a pattern in a file.

I have used only these till now. For more, refer this. For vim tips, refer this.

 

Unix/Linux

  1. ls : directory listing.
  2. ls -al : formatted listing, also shows hidden files.
  3. cd dir : change to directory.
  4. cd : back to home.
  5. pwd : gives present working directory.
  6. mkdir dir : create new  directory dir
  7. rm file_name : delete a file.
  8. rm -r dir_name : delete a folder/ directory, recursively removing all files.
  9. rm -f file_name : forced removal of file.
  10. cp file1 file2 : copy file1 to file2.
  11. cp -r dir1 dir2 : copy directory1 to directory2, recursively copying all files.
  12. mv file1 file2 : move or rename file1 to file2.
  13. touch file : create a file.
  14. more file_name : output the contents of the file.
  15. ps : currently active process.
  16. top : displays all running process. When sometimes your system speed is slow, you can use it to check. 🙂
  17. kill pid : kill process with process id as pid. You can get the pid from top.
  18. chmod 777 : read, write and execute for all.
  19. ssh user@host or ssh ip : to connect to ip.
  20. date : shows the current date and time.
  21. cal : shows this month’s calender.
  22. whoami : who you are logged in as.
  23. uname -a : shows kernel information.
  24. man some_command : shows manual page entry for “some_command”
  25. df : shows disk usage.
  26. free : shows memory and swap usage.
  27. tar -xvzf name.tar.gz : untar a file. x : extract, v : verbose, z : tar.gz, f : file.
  28. ping host : ping host and output results.
  29. whois domain : to get the information about the domain.
  30. wget file : to download a file.
  31. ./configure
    make
    make install : to install from source
  32. CTRL + C : to halt the current command.
  33. CTRL + Z : to stop the current command.
  34. CTRL + D : to log out of current session, to give EOF to a program. If you code.
  35. !! : to repeat the last command, will also print it.
  36. exit : to log out of current session.
  37. sudo chown -Rc kt:kt /home/kt/ : This changes permissions of everything in home/username/ to username:username.

I have used these till now. For more, read this.

 

Back to coding ❤.

Tapasweni Pathak

 

 

Advertisements

2 thoughts on “I use Vim and Linux and You?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s