Linux-Basics-Complete-Course-With-Notes-Slides

Lab - Working with shell

  1. To check the home directory for a particular user say bob
    $ grep bob /etc/passwd | cut -d ":" -f6
    
  2. To check the home directory for a particular user using built in shell variables
    $ echo $HOME
    
  3. In the command echo Welcome, what does the word Welcome represent with respect to the command? ``` $ echo Welcome
    • Where Welcome is an argument ```
  4. To check git command type
    $ type git
    
  5. To create a directory
    $ mkdir /home/bob/birds
    
  6. To create directories recursively
    $  mkdir -p /home/bob/fish/salmon
    
  7. Create few more directories
    $ mkdir -p /home/bob/mammals/elephant
    $ mkdir -p /home/bob/mammals/monkey
    $ mkdir /home/bob/birds/eagle
    $ mkdir -p /home/bob/reptile/snake
    $ mkdir -p /home/bob/reptile/frog
    $ mkdir -p /home/bob/amphibian/salamander
    
  8. To move a directory
    $ mv /home/bob/reptile/frog /home/bob/amphibian
    
  9. To rename a directory
    $ mv /home/bob/reptile/snake /home/bob/reptile/crocodile
    
  10. To delete a directory
    $ rm -r /home/bob/reptile