Useful Linux Basic commands


Linux, being a powerful and flexible operating system, offers a wide range of commands that can enhance your productivity and streamline your workflow. Here are some useful Linux commands that can come in handy:

1. ls: Lists the files and directories in the current directory.

2. cd: Changes the current directory. Use “cd [directory_name]” to navigate to a specific directory.

3. mkdir: Creates a new directory. For example, “mkdir my_folder” will create a directory named “my_folder”.

4. rm: Deletes files or directories. Use “rm [file_name]” to remove a file, and “rm -r [directory_name]” to remove a directory.

5. cp: Copies files or directories. Use “cp [source_file] [destination_directory]” to copy a file, and “cp -r [source_directory] [destination_directory]” to copy a directory.

6. mv: Moves or renames files or directories. Use “mv [source] [destination]” to move or rename a file/directory.

7. touch: Creates an empty file. For example, “touch myfile.txt” will create a file named “myfile.txt”.

8. cat: Displays the content of a file. Use “cat [file_name]” to view the content of a file.

9. grep: Searches for a specific pattern in a file or output. For example, “grep ‘keyword’ myfile.txt” will search for the keyword in the file.

10. pwd: Prints the current working directory.

11. sudo: Executes a command with administrative privileges.

12. apt-get: Package management command for Debian-based systems. Use “apt-get install [package_name]” to install a package.

13. yum: Package management command for Red Hat-based systems. Use “yum install [package_name]” to install a package.

14. ssh: Connects to a remote server via Secure Shell (SSH). For example, “ssh user@hostname” will establish an SSH connection to the specified hostname.

15. man: Displays the manual pages for a specific command. Use “man [command_name]” to access the manual pages and learn more about a command.

These are just a few examples of the many useful commands available in Linux. Exploring the vast array of commands and their functionalities can greatly enhance your experience and efficiency when working with the Linux operating system.