Sunday, 4 April 2021

Getting Started with Linux command line

The Linux command line is a powerful tool for interacting with your computer and performing various tasks. Here are the basic steps to get started with the Linux command line:

  1. Open a terminal window. On most Linux distributions, you can open the terminal by pressing the key combination Ctrl + Alt + T.
  2. Use the ls command to list the files and directories in the current directory.

     ls
    
  3. Use the cd command to change the current directory. For example, to change to the home directory, you would use the command:

     cd /home/ubuntu/
    
  4. Use the pwd command to display the current working directory.

     pwd
    
  5. Use the mkdir command to create a new directory. For example, to create a new directory called "myfolder", you would use the command:

     mkdir myfolder
    
  6. Use the touch command to create a new empty file. For example, to create a new file called "myfile.txt", you would use the command:

     touch myfile.txt
    
  7. Use the rm command to delete a file or directory. For example, to delete the file "myfile.txt", you would use the command: (run this carefully)

     rm myfile.txt
    
  8. Use the cp command to copy a file or directory. For example, to copy the file "myfile.txt" to a new file called "myfile_backup.txt", you would use the command:

     cp myfile.txt myfile_backup.txt
    
  9. Use the mv command to move or rename a file or directory. For example, to rename the file "myfile.txt" to "mynewfile.txt", you would use the command:

     mv myfile.txt mynewfile.txt
    

Other:

  1. "cat" - Displays the contents of a file.
  2. "grep" - Searches for a specific string in a file or multiple files.
  3. "find" - Searches for files based on various criteria such as name, size, and time modified.
  4. "man" - Displays the manual pages for a command.
  5. "chmod" - Changes the permissions of a file or directory.
  6. "sudo" - Allows a user to run a command with administrative privileges.

These are just a few basic examples of how to use the Linux command line. There are many more commands and options available, and it's worth exploring and learning more about the command line.

It's important to note that the command line uses case-sensitive, so be careful of the case when you type the command.

No comments:

Post a Comment