Linux Commands

What is ls and pwd command in Linux?
  • ls – list directory contents
    • list the content of the directory.
    • for the manual page click here or run “man ls” in the terminal.
  • pwd – print name of current/working directory
    • for the manual page click here or run “man pwd” in the terminal.
vim/vi editor commands.
  • vim test.c //
    • creates a file with a name test.c and opens it in vim/vi editor if the file doesn’t present with the same name, if a file with name test.c is present already then shows its contents in vi editor
  • vim then press ‘i’ key.
    • enter in insert mode, press ESC to come outside of insert mode

/* commands outside insert mode */

open vi the press below keys.

  • w
    • advance to the next word
  • e
    • advance to the end of the word
  • e
    • move to the previous word
  • yy
    • copy line, press p to paste it
  • nyy
    • copy n lines after the cursor
  • dd
    • delete the line, and press p to paste the deleted line
  • ndd
    • deletes n lines after cursor
  • u
    • undo last
  • U
    • undo all changes to the current line
  • o
    • add a new line below the cursor line
  • O
    • add a new line above the cursor line
  • /word
    • move to the occurrence of “word”, to search next occurrence press n
  • :w
    • save changes
  • :w [new]
    • save changes to a new file named “new”
  • :wq
    • save and quit
  • :q
    • quit
  • :q!
    • quit without saving the changes
  • click here to find more information about vim.
objdump command
  • objdump – display information from object files
  • click here to see the manual page or run man objdump on the terminal.

2 thoughts on “Linux Commands”

Leave a Comment