Linux Commands🐧

open source enthusiast | developer
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 stringls- list files in a directorycd- change directorypwd- print working directorymkdir- make a directoryrmdir- remove a directoryrm- remove a filecp- copy a filemv- move a filecat- concatenate files and print on the standard outputgrep- search for a pattern in a file
User accounts
whoami- print the name of the current userid- print the user ID of the current usersudo- run a command as rootsu- run a command as another user
Download files
curl <url>- download a file from the internetwget <url>- download a file from the internet
Check OS version
uname -a- print operating system informationlsb_release -a- print operating system information
Package managers
RPM: Red Hat Package Manager
rpm -i <package>- install a packagerpm -e <package>- remove a packagerpm -q <package>- query a package
YUM: Yum Package Manager
yum install <package>- install a packageyum remove <package>- remove a packageyum list <package>- query a packageyum repolist- list available repositories
Services
service <service> start- start a servicesystemctl start <service>- start a servicesystemctl stop <service>- stop a servicesystemctl status <service>- check the status of a servicesystemctl enable <service>- enable a service to start at bootsystemctl 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 configurationroute- print routing tablenetstat- print network statisticsping <host>- send ICMP echo request to a hosttraceroute <host>- trace the route to a hostdig <host>- query DNS informationnslookup <host>- query DNS informationnmap <host>- scan a networkss- print network statistics
Routing
route add -net <network> <gateway>- add a routeroute del -net <network>- delete a routeroute add -host <host> <gateway>- add a route



