Ravindra BagaleCourses & study guides

Chapter 3: Linux Basic Commands

3.1 Why Linux?

More than 90% of cloud servers run Linux. It is free, stable, secure and fully controllable from the command line, which makes automation easy. On AWS, Amazon Linux, Ubuntu, RHEL/CentOS, Debian and SUSE are all available. There is usually no graphical desktop on a server — you manage it through a shell (usually bash) over SSH.

Linux file-system hierarchy

/                  root of everything
├── bin, sbin      essential commands (now links to /usr/bin, /usr/sbin)
├── boot           kernel and boot loader
├── dev            device files (/dev/nvme0n1, /dev/xvda)
├── etc            configuration files (nginx, ssh, fstab, passwd)
├── home           users' home folders (/home/ec2-user, /home/ubuntu)
├── root           home of the root user
├── opt            optional / third-party software
├── tmp            temporary files (cleared on reboot)
├── usr            programs, libraries, docs (/usr/share/nginx/html)
├── var            variable data: logs (/var/log), web (/var/www), databases (/var/lib/mysql)
├── proc, sys      virtual files with kernel & hardware info
└── mnt, media     mount points for extra disks

Everything is a file

In Linux, disks (/dev/nvme1n1), processes (/proc/1234) and even hardware info are represented as files. Paths are case-sensitive: Index.html and index.html are different files.