Linux Flashcards
Configure IP address command on linux
sudo ip addr add 192.168.1.10/24 dev eth0
Network configuration file path on Debian and Ubuntu
/etc/network/interfaces
Network configuration file path on RHEL/CentOS
/etc/sysconfig/network-scripts/ifcfg-eth0
Configure IP route on Linux
sudo ip route add 192.168.2.0/24 via 192.168.1.1 dev eth0
DNS servers configuration file path on linux
/etc/resolv.conf
Display first 20 lines of a file on Linux
head -n 20
Display first 20 characters of a file on Linux
head -c 20
Substitution command. Substitute ( and ) by [ and ]
Hey (my name) is (josh)
tr “(“ “[” | tr “)” “]”
Hey, [my name] is [josh]
chmod 777
OGU
owner-group-user
7 = owner
7 = group
7 = user
chmod permission values
r = ?
w = ?
x = ?
r = 4
w = 2
x = 1
chmod with letters
+: adds permission
chmod o+rwx
chmod g+rwx
chmod u+rwx
-: removes permission
chmod o-x
chmod g-w
chmod u-w
=: sets permission overriding existing ones: (on below example read and write permissions won’t be granted, just execute permission)
chmod o=x
chmod g=x
chmod u=x
basic components of Linux
- kernel
- system libraries
- system utilities
- programming tools
Linux file system hierarchy
- /etc contains configuration files
- /dev contains device files
- /home contains user home directories
- /usr contains user utilities and applications
- /var contains variable data files
Check Linux Memory Utilization
free -h
What are Shells Used in Linux?
Shells in Linux are command-line interpreters that provide a user interface for access to an operating system’s services. They allow users to execute commands, run scripts, and manage files and processes.
What is the Linux Kernel?
The Linux Kernel is the core of the Linux operating system. It interacts directly with the hardware and provides services for the rest of the system. It’s open-source, meaning its source code is freely available and can be modified and distributed.
Check Linux System Information?
uname -a
Run Multiple Commands in a Single Command?
use ;
or &&
Check Linux Disk Space Utilization
df -h
Process States in Linux
- Running (R)
- Uninterruptible Sleep (D)
- Interruptable Sleep (S)
- Stopped (T)
- Zombie (Z)
Soft Link (symbolic / symlink)
A Soft Link (also known as a symbolic link or symlink) is a file that points to another file or directory. If the original file is deleted or moved, the soft link will not work correctly.
Hard Link
A Hard Link is a directory entry that associates a name with a file. Creating additional hard links for a file makes the contents of that file accessible via additional paths.
How Long the Linux System Has Been Running
uptime
Configure default route
sudo ip route add default via 192.168.1.1