"Simplify Your Linux Journey: The Basics of Command Line" Part -01

Yasmeen KhanYasmeen Khan
2 min read

Linux is a free and powerful computer operating system that many people use because it's reliable, secure, and customizable. Below are the basic linux commands which will help you to get started with linux.

  1. mkdir (Make Directory): Creates a new directory.

  2. ls(list) - let's say you want to list all the files and directories in your current directory. Then we can run this command ls

  3. touch: Creates an empty file.

  4. cd (Change Directory): Changes the current directory.

  5. pwd (Print Working Directory): Shows the current working directory.

  6. rm (Remove): Deletes files or directories.

  7. cp (Copy): Copies files or directories.

  8. mv (Move): Moves or renames files or directories.

  9. cat (Concatenate): Displays the content of a file.

Examples for ls :

  1. ls -a > list all including hidden files and directory.

  2. ls *.sh > list all the files having .sh extension.

  3. ls -l > list the files and directories in long list format with extra information.

  4. ls -i > list the files and directories with index numbers inodes.

  5. ls /d */ > list only directories.(we can also specify a pattern).

Examples for cd :

  1. cd .. > Change the directory one step back.

  2. cd - >switch to the last working directory.

  3. cd ../.. > Change directory to 2 levels back.

Examples for mkdir:

1.

mkdir .NewFolder              # make a hidden directory (also . before a file to make it hidden)
  1.  mkdir  A B C D                 #make multiple directories at the same time
    
     mkdir /home/user/Mydirectory   # make a new folder in a specific location
    
     mkdir -p  A/B/C/D              # make a nested directory
    
0
Subscribe to my newsletter

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

Written by

Yasmeen Khan
Yasmeen Khan