- Linux is an operating system
- At the heart of the OS is the Linux Kernel
- Linux is the layer between applications and hardware
- Linux can be used as a server or a desktop
- Distributions are implementations of Linux, each with their own goals and focus
- Linux Distro = kernel + software
- 2 most popular distro
- redhat (use CentOS with different branding/logos)
- Banks, Airlines, Telecoms, Healthcare
- Ubuntu
- Startups, SaaS, Social Networks, Cloud Based
- Other Linux distro
- Linux Mint, Debian, Mageia, Fedora, openSUSE, Arch Linux, Slackware
/
"Root", the top of the file system hierarchy/bin
Binaries and other executable programs/boot
Files needed to boot the operating system/cdrom
Mount point for CD-ROMs/cgroup
Control Groups hierarchy/dev
Device files, typically controlled by the operating system and the system administrators/etc
System configuration files/export
Shared file systems/home
Home directories/lib
System Libraries/lib64
System Libraries, 64 bit/lost+found
Used by the file system to store recovered files after a file system check has been perform/media
Used to mount removable media like CD-ROMs/mnt
Used to mount external file systems/opt
Optional or third party software/proc
Provides info about running processes/root
The home directory for the root account/sbin
System administration binaries/selinux
Used to display information about SELinux/srv
Contains data which is served by the system/srv/www
Web server files/srv/ftp
FTP files/sys
Used to display and sometimes configure the devices known to the Linux kernel/tmp
Temporary space, typically cleared on reboot/usr
User related programs, libraries, and docs/usr/bin
Binaries and other executable programs/usr/lib
Libraries/usr/local
Locally installed software that is not part of the base operating system/usr/sbin
System administration binaries/var
Variable data, most notably log files/var/log
Log files
- Applications that are not part of the base OS can be installed in:
/usr/lcoal
/opt
- programs installed in
/usr/local
/usr/local/crashplan/bin
/usr/local/crashplan/etc
/usr/local/crashplan/lib
/usr/local/crashplan/log
- programs installed in
/opt
/opt/acme
/opt/acme/bin
/opt/acme/etc
/opt/acme/lib
/opt/acme/log
- programs installed with company name then product name
/opt/google
/opt/google/chrome
/opt/google/earth
- other variation which add organization name
/opt/web-team
/opt/acme/web-team
/usr/local/acme/web-team
- other variation
/etc/opt/myapp
/opt/myapp/bin
/opt/myapp/lib
/var/opt/myapp
- sometimes installed without their own directory structure, and installed in a share manner
/usr/local/bin/myapp
/usr/local/etc/myapp.conf
/usr/local/lib/libmyspp.so
- common practice
/opt/companyName
- The default interface to Linux
- A program that accepts and executes commands
- Also called as command line interpreter
- Command Line Interface (CLI) vs Graphic User Interface (GUI)
- CLI can do everything a GUI can do
- Server distros do not include GUIs
- Desktop distros have GUIs and CLIs
- The Prompt
- Displays current user and name of Linux system
$
current user is a normal user#
current user is Superuser (root)~
represents home directory- Tilde Expansion
~username
->/home/username
~root
->/root
~ftp
->/srv/ftp
- Root, the Superuser
- Root access is typically restricted to system administrators
- Root access may be required to install, start, or stop an application
ls
Lists directory contents-l
long listing format
cd
Changes the current directorypwd
Displays or print the current working directorycat
Concatenates and displays filesecho
Displays arguments to the screenman
Displays the online manualexit
Exits shell or current sessionclear
Clears the screen
ls
ls -a # show hidden and system files
ls -l # show extra information
mkdir <folderName>
cd <folderName>
cd .. # to go back 1 level
cd / # root directory
cd # go to home directory
cd ~ # go to home directory
touch <fileName>
cat <fileName>
less <fileName> # Show the content of a big file with page down
mv <fileName> <newFileName>
copy <fileName> <fileNameCopy>
cp <fileName> <locationPath/fileName>
rm <fileName> # Remove a file
rmdir <folderName> # Remove a folder
rm -r <folderName> # Remove a folder that is not empty
$ which <fileName> # or <folderName>
history
sudo <commands>
uname -a
# Linux DESKTOP-KCGTGRV 4.4.0-43-Microsoft #1-Microsoft Wed Dec 31 14:42:53 PST 2014 x86_64 x86_64 x86_64 GNU/Linux
uname -r
dpkg --print-architecture
# amd64
cat /etc/issue
# Debian GNU/Linux 9 \n \l
ifconfig
iwconfig
ping google.com
uname -a
blkid
top
df
lsusb
lspci
sudo apt-get install <packageName>
sudo apt-get remove <packageName>
sudo apt-get update
sudo shutdown -h
sudo shutdown -h 10 # with 10mins time
sudo shutdown -h now # Shutdown right away
sudo shutdown -r # Restart
Nuclear option: https://askubuntu.com/questions/525088/how-to-delete-broken-packages-in-ubuntu