Skip to content

Instantly share code, notes, and snippets.

@savolla
Last active July 22, 2019 07:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save savolla/acf178edccb27593cdc508497f2c5632 to your computer and use it in GitHub Desktop.
Save savolla/acf178edccb27593cdc508497f2c5632 to your computer and use it in GitHub Desktop.

lec-linux

lec 1 (command line essentials)

pwd

  • prints working directory

cd

  • changes directories
    cd / # navigato to the start of the harddisk
    cd /usr/share # example
    cd savolla # no absolute path using tab tab
    cd ./lib # . means current directory
    
    # navigating to home 3 ways
    cd /home/savolla #
    cd ~/savolla # if you are lazy
    cd # if you are ultra lazy
    
    cd ../ # go one level up. go backward
    cd ../../../etc # go 3 levels back and press tab tab
        
  • summary
    pwd # prints current directory
    cd ../ # goes backward
    cd ./ # means current directory
    cd / # means go to the very beginning like C:\\ in windows
    
        

ls

  • what’s the point if we just navigate accross the file system but can’t do anything?
    ls # lists content of the current directory
    ls -l # lists more information
    ls -l ~/Documents # list directories without leaving the current directory
        

lec 2 (file permissions)

  • edit one file from /etc/hostname
  • show that they can’t change the file
  • ls -l /etc/hostname to show the privilages
  • tell them about root user

sudo

sudo <command> # runs as super user
sudo vim /etc/hostname

whoami

whoami # shows the current user

su

  • what if we don’t want to use sudo everytime
    su root # switch to the super user (root)
    whoami # show who am i
    vim /etc/hostname
    
    su nick # switch back to my user account way 1
    exit # switch back to my user account way 2
        

lec 3 (software installation)

  • tell about package managers
    sudo apt-get install <program name> # ubuntu
    sudo yum install <program name> # centos:
    sudo pacman -S <program name> # arch
        
yum install ranger # install ranger
  • talk about dependencies
  • talk about repositories and tell that different distros have different repositories and different programs
  • if I don’t like the program I can remove it
    sudo apt-get remove <program name> # ubuntu
    sudo yum remove <program name> # centos:
    sudo pacman -Rs <program name> # arch
        

lec 4 (other commands)

  • talk about user permissions

chown

chown user:group <file>
chown -R user:group <file>

chmod

chmod u+rx

rm

mkdir

grep

awk

vim

bash scripting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment