Essential Linux Commands

Directory and File Management

  • pwd Prints the current working directory.

  • mkdir <directory-name> Creates a new directory or folder.

  • touch <file-name> Creates a new empty file.

  • ls Lists the files and folders in the current directory.

  • ls -ltr Lists files and directories with detailed information.

  • cd <directory-path> Changes the current directory to the specified path.

  • cd .. Moves up one level in the directory hierarchy.

  • cd ../.. Moves up two level in the directory hierarchy.

  • cd ~ Navigates to the home directory of the current user.

File and Directory Deletion

  • rm <file-name> Deletes a file.

  • rm -r <directory-name> Recursively deletes a directory and its contents.

File Operations

  • mv <old-file-name> <new-file-name> Renames or moves a file.

  • cp <source-file> <destination-file> Copies a file to a new location.

  • cp -r <source-dir> <destination-dir> Recursively copies a directory and its contents.

  • cat <file-name> Displays the contents of a file.

  • vi <file-name> Opens the file in the Vi editor for viewing or editing. If the file doesn’t exist, it creates one.

System Information & Help

  • man <command> Displays the manual (documentation) for any Linux command.

  • chmod <options> <file> Changes permissions for a file or directory.

  • nproc Displays the number of available CPU cores.

  • ps -ef Shows a detailed list of all running processes.

  • history Displays the list of commands previously executed in the terminal.

  • clear Clears the terminal screen.

Conclusion

These commands form the foundation of efficient navigation, file handling, and system management in a Linux environment. Keep practicing!

Thank you for reading!

0
Subscribe to my newsletter

Read articles from Abhamayee Mahanta directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Abhamayee Mahanta
Abhamayee Mahanta

Abhamayee is a skilled Software Engineer with a BTech in Computer Science Engineering from India. Currently staying in Toulouse, France.She possesses expertise in Java, SQL, and Shell scripting. She has hands-on experience in technologies such as Spring, Spring Boot, Hibernate, AWS, and Kafka.