Thursday 17 December 2015

50 Basic Linux commands for server admins.

Linux_Experts Group:  https://www.youtube.com/channel/UCgCP_rPV7tarYKL4Bh82Dgg

1) ls -ltr --> Long list with the last modified time.
2) top --> Check running processes.
3) pwd --> Currently working directory.
4) uptime --> Server uptime.
5) uname -a --> Server Name and OS version.
6) clear -->Clear the screen.
7) cd -->Change directory.
8) history -->Commands history.
9) cp <Source> <Destination> --> Copy from source to destination.
10) mv <Source> <Destination>--> Move from source to destination.
11) df -h <dir>   --> Check filesystem usage.
12) mkdir <filename> --> Make directory.
13) rmdir <filename --> Remove directory.
14) ps -ef --> Check services.
15) sar 2 5 --> CPU usage.
16) sar -B 2 5 --> System paging rate.
17) free mt --> Check memory usage.
18) sort -nr --> Sort the listed output.
19) head -5 -->Top 5 outputs.
20) tail -5 --> Last 5 outputs.
21) grep -i --> Fetch the matched contents.
22) grep -v --> Exclude the matched contents.
23) kill --> Kill the particular process.
24)w -->Who is logged on and what they are doing
25) passwd <usrname> --> Change password.
26) chmod --> Modify the filesystem, Change the access permission.
27) chown x:x <filename> --> Change File Ownership.
28) rm -rf --> Remove forcefully.
29) du -sh * --> Total disk space occupied by files and subdirectories.
30) cat /etc/shadow --> Check user password information.
31) cat /etc/passwd --> Check users information.
32) sudo su - --> To login as a root from current user.
33) ifconfig -a --> Network interfaces.
34) service <xyz> status --> Check service status.
35) service <xyz> start/stoop --> Start/stop services.
37) gzip <filename> -->Compresses the contents of files.
37) gunzip <filename> -->Unzip the compressed file.
38) diff <file1><file2> -->Lists all lines that do not match.
39) mount <mountpoint> -->Mount any data media to Linux directory.
40) nslookup <IP OR Server name-->The DNS resolves domain names to IP addresses & vice versa.
41) touch <filename> -->Create a blank txt file.
42) vim <filename> --> Open and edit the file.
43) crontab -l -->List the cron jobs.
44) locate <filename> -->Search for the location of a specific file.
45) vmstat -->Info about processes, memory, paging, and cpu activity.
46) who -->tells you who's logged on, and where they're coming from
47)  useradd <username> --> Add new user.
48) userdel <username> --> Delete the user.
49) reboot --> Restart the system.
50) shutdown --> System shut down.