Basics linux or unix commands a beginner should start with

Why to learn or use these commands

  • It’s much more comfortable and faster
  • It's much more flexible and efficient then graphical environment
  • Working With Text Files is Easier
  • You Can Probably Type Faster Than You Click

So lets focus on some basic commands which you should start with. These are the commands with which you may be working daily and you will be too used to of it that you will hardly use gui again

Where to use

  • Linux or Mac users can use these commands on terminal. It is just an interface to the Shell and to the other command line programs that run.
  • There is built-in command shell, but that is based on the MS-DOS command line and not on UNIX. Windows users can install git bash or wsl.

Basic Commands

  • 1. pwd

    • pwd stands for print working directory
    • It gives us the absolute path, which means the path that starts from the root(base).

Like here i am in projects directory it gives the path of this directory Screenshot 2021-10-30 at 6.19.44 PM.png

  • 2. ls

    • ls stands for a list and it lists the contents of a directory

    • Here ls shows all files inside projects Screenshot 2021-10-30 at 6.23.44 PM.png

    • Note You can use ls -a to see the hidden files

  • 3. cd

    • cd stands for Change Directory
    • cd <Directory>: It changes current directory to desired directory

Screenshot 2021-10-30 at 6.31.19 PM.png

  • cd ..: To go back to the parent directory.

Screenshot 2021-10-30 at 6.32.29 PM.png

  • cd: To go back to the home directory

Screenshot 2021-10-30 at 6.32.39 PM.png

  • If there is directory named Hello World we can't use cd Hello World it will consider World as different thing so either used " " or \ like this
    • "cd Hello World"
    • or
    • cd Hello\ World
  • 4. mkdir

    • mkdir stands for make directory
    • mkdir <name> is used to make new directory or folder
  • 5. rmdir

    • rmdir stands for remove directory
    • rmdir <name> can only be used to delete an empty directory
  • 6. rm

    • rm stands for remove
    • It is used to delete the folder and the files Screenshot 2021-10-30 at 7.25.54 PM.png

    • By default rm does not delete directory Screenshot 2021-10-30 at 7.26.50 PM.png

    • Using rm -r It delete the directory (r in -r stands for recursively) Screenshot 2021-10-30 at 7.27.32 PM.png

  • 7. cp

    • cp stands for copy
    • cp Src_file Dest_file It copies the content source file to destination file
  • 8. mv

    • mv stands for move
    • mv Src_file Dest_file It moves the content source file to destination file
    • If the destination file does not exist it automatically creates one
  • 9. touch

    • touch <filename> It is used to create a file without any content.
    • The file created using touch command is empty. Screenshot 2021-10-30 at 7.04.28 PM.png
  • 10. cat

    • catstands for concatenate
    • cat <filename> It is used to display content of file Screenshot 2021-10-30 at 7.09.50 PM.png
  • 11. echo

    • echo <argument> It is is used to display line of text/string that are passed as an argument . Screenshot 2021-10-30 at 7.13.51 PM.png

    • echo <String> >> dest_fileIt is also used to move some data, usually text into a file Screenshot 2021-10-30 at 7.19.28 PM.png