Skip to content

Instantly share code, notes, and snippets.

@sayanarijit
Created February 15, 2021 09:02
Show Gist options
  • Save sayanarijit/c6f5a59c37904571411ae218c0aeb981 to your computer and use it in GitHub Desktop.
Save sayanarijit/c6f5a59c37904571411ae218c0aeb981 to your computer and use it in GitHub Desktop.
Linux Introduction

Introduction

  • Linux is only a kernel (collection of drivers, task schedulers etc).
  • Red Hat, Fedora, Ubuntu, Manjaro, Kali, NixOS etc. are OS distributions (uses the Linux kernel).
  • Linux OSes can be used via CLI (suitable for servers) or GUI (suitable for personal laptops/desktops).
  • Linux CLI
    • sh
    • bash
    • csh
    • ksh
    • zsh
    • fish
  • Linux GUI:
    • Window Manager
      • X org (DE required)
      • Wayland (DE required)
      • bspwm
      • i3
      • i3-gaps
      • awesomewm
      • dwm
      • ...
    • Desktop Environment (All requires WM)
      • Gnome
      • KDE
      • Mate
      • Unity
      • xfce
      • ...
  • Linux is multi-user (multiple users can login at the same time)
  • "root" is the superuser

Commands

  • cat to see the contents of a text file e.g. cat /etc/fstab
  • nslookup to get the IP address from domain name or vice versa e.g. nslookup ip, nslookup domain
  • ifconfig to get the IP addresses of my machine
  • yum to install or update packages in RedHat (apt-get in Ubuntu, pacman in Arch etc.) e.g. yum update, yum install python, yum remove python
  • ping to check if a server is online/responding (ICMP is blocked by AWS) e.g. ping ip, ping domain
  • ssh to login into remote servers e.g. ssh -i keyfile username@ip, ssh username@domain
  • scp to login into remote servers e.g. scp -i keyfile /source username@ip:/destination, scp /source username@domain:/destination
  • cd to move into a directory e.g. cd /tmp
  • mkdir to make directory e.g. mkdir dir
  • ls to list files inside a directory e.g. ls, ls /tmp, ls -l
  • pwd to get the present working directory e.g. pwd
  • tracert to get the gateway IP addresses of the given destination address/domain e.g. traceroute google.com
  • ip link show to get the network interfaces, mac addresses (active + inactive)
  • ip route show to get the gateway addresses of the machine.
  • mount to mount a filesystem (partition / shared filesystem etc.)
  • umount to unmount a filesystem (partition / shared filesystem etc.) e.g. mount /dev/sda1 /mnt/directory
  • fdisk see and update the attached disks and partitions e.g. fdisk -l, fdisk /dev/sda
  • tree to get the directory tree
  • which to get the location of the command e.g. which ls
  • man manual for any command. e.g. man ls
  • df -h list the mounted partitions
  • su switch user
  • whoami or id to see who I am logged in as
  • systemctl start/stop/restart/reload/enable/disable to manage running services
  • chmod to change file mode. e.g. chmod +x filename to give execute permission.
  • mv to move or rename file or directory
  • cp to copy file or directory
  • rm to remove file or directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment