Useful Linux Commands

Useful Linux Commands

ยท

1 min read

Directory Operations

  1. pwd -> displays current working directory.
  2. mkdir -> make a new directory.
  3. cd directory_name -> move into that directory.
  4. ls -> list contents of current directory.
  5. ll -> list contents of current directory with detailed info.
  6. rm -r directory_name -> remove a directory

File Operations

  1. touch filename -> creates a empty file.
  2. ls -l -> list the contents in current directory.
  3. echo "message" -> to display any message.
  4. echo "message" > new.txt -> move the message in text file.
  5. read -> to take input from user.
  6. read -p "Enter any message" n -> to display and take input from the user.
  7. nano filename -> to create and open new file.

copy/rename/move operations

  1. cp A.txt B.txt -> makes a copy of A.txt names it to B.txt in current directory.
  2. mv testdir newdir -> renames testdir to newdir in current path.
ย