Types of shells
- Bourne shell (sh shell)
- C shell (csh shell)
- Z shell (zsh shell)
- Bourne again shell (bash shell)
linux commands
basic commands
-
echo- print a string -
ls- list files in a directory -
cd- change directory -
pwd- print working directory -
mkdir- make a directory -
rmdir- remove a directory -
rm- remove a file -
cp- copy a file -
mv- move a file -
cat- concatenate files and print on the standard output -
grep- search for a pattern in a file
User accounts
-
whoami- print the name of the current user -
id- print the user ID of the current user -
sudo- run a command as root -
su- run a command as another user
Download files
-
curl <url>- download a file from the internet -
wget <url>- download a file from the internet
Check OS version
-
uname -a- print operating system information -
lsb_release -a- print operating system information
Package managers
RPM: Red Hat Package Manager
-
rpm -i <package>- install a package -
rpm -e <package>- remove a package -
rpm -q <package>- query a package
YUM: Yum Package Manager
-
yum install <package>- install a package -
yum remove <package>- remove a package -
yum list <package>- query a package -
yum repolist- list available repositories
Services
-
service <service> start- start a service -
systemctl start <service>- start a service -
systemctl stop <service>- stop a service -
systemctl status <service>- check the status of a service -
systemctl enable <service>- enable a service to start at boot -
systemctl disable <service>- disable a service to start at boot
VI editor
-
vi <file>- open a file in vi editor - to switch to insert mode:
i - to switch to command mode:
esc - to switch to visual mode:
v - to switch to replace mode:
r - to delete a character:
x - to delete a line:
dd - to delete a word:
dw - to copy a line:
yy - to paste a line:
p - to save a file:
:wq - to quit vi:
:q - to quit vi without saving:
:wq! - to quit vi and exit:
:q!
Networking
-
ifconfig- print network interface configuration -
route- print routing table -
netstat- print network statistics -
ping <host>- send ICMP echo request to a host -
traceroute <host>- trace the route to a host -
dig <host>- query DNS information -
nslookup <host>- query DNS information -
nmap <host>- scan a network -
ss- print network statistics
Routing
-
route add -net <network> <gateway>- add a route -
route del -net <network>- delete a route -
route add -host <host> <gateway>- add a route
Top comments (0)