Skip to content

Instantly share code, notes, and snippets.

@anshdhinhgra47
Last active March 14, 2022 05:22
Show Gist options
  • Save anshdhinhgra47/e9ca58b360240cfc703c587840b3a211 to your computer and use it in GitHub Desktop.
Save anshdhinhgra47/e9ca58b360240cfc703c587840b3a211 to your computer and use it in GitHub Desktop.

Basic commands in Unix Systems

  • Finding the username of the currently logged in user: whoami
  • Finding all the users: who
  • Printing text: echo "your_text"
  • New line character: -n
  • Prinitng a banner in command-line: banner -w(width) 'your_text'
  • Displaying the current shell you are working in: echo $0
  • Viewing a text file: less file_name
  • Creating nested directories: mkdir -p dir_1/dir_2/....
  • Recursively copying directories: cp -R dir_to_be_copied new_dir_name
  • Deleting a directory with contents in it: rm -R dir_name
  • Creating a Symbolic Link: ln -s file_name symlink_name
  • Searching for a file/dir: find path_of_file expression
  • Displaying ownership of all files: ls -l
  • Changing the ownership of a file: chown user_name:group_name path_to_the_file
  • Executing the last command: sudo !!
  • Returning the location of a command: which command_name
  • Reading manual for a command: man command_name
  • Calculating free disk space: df
  • Calculating the disk occupied: du
  • Calculating the file system information upto a depth: du -d depth
  • Forcefully killing a process: kill -9 process_id
  • Setting up a PATH variable: export PATH_NAME="PATH_LOCATION"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment