x32x01
  • by x32x01 ||
Linux is becoming well known because it’s more than just free software as it’s unusually a good operating system. Linux was first developed by Linus Torvalds at the University of Helsinki in Finland.

If you’ve never worked with Linux before, you may be confused as to why there are so many different versions of it available. Linux commands are not the same as standard Unix ones. Most of the commands are provided by the GNU project.
Linux Commands Cheat-Sheet
Back before the days of graphical desktops, the only way to interact with a Unix system was through a text command line interface (CLI) provided by the shell. The CLI allowed text input only, and could only display text and rudimentary graphics output.

If you’re just beginning to work on a Linux system in this year (2020), the abundance of commands might prove daunting. To help, the following lists present a sampling of commands on various topics such as Networking, File Management, Programming etc.

S.NoCommandsDescription
1uname -aDisplay Linux system information
2uname -rDisplay kernel release information
3cat /etc/redhat-releaseShow which version of redhat installed
4uptimeShow how long the system has been running + load
5hostnameShow system host name
6hostname -IDisplay the IP addresses of the host
7last rebootShow system reboot history
8dateShow the current date and time
9calShow this month’s calendar
10wDisplay who is online
11whoamiWho you are logged in as
12dmesgDisplay messages in kernel ring buffer
13cat /proc/cpuinfoDisplay CPU information
14cat /proc/meminfoDisplay memory information
15free -hDisplay free and used memory ( -h for human readable, -m for MB, -g for GB.)
16lspci -tvDisplay PCI devices
17lsusb -tvDisplay USB devices
18dmidecodeDisplay DMI/SMBIOS (hardware info) from the BIOS
19hdparm -i /dev/sdaShow info about disk sda
20hdparm -tT /dev/sdaPerform a read speed test on disk sda
21badblocks -s /dev/sdaTest for unreadable blocks on disk sda
22topDisplay and manage the top processes
23htopInteractive process viewer (top alternative)
24mpstat 1Display processor related statistics
25vmstat 1Display virtual memory statistics
26iostat 1Display I/O statistics
27tail 100 /var/log/messagesDisplay the last 100 syslog messages (Use /var/log/syslog for Debian based systems.)
28tcpdump -i eth0Capture and display all packets on interface eth0
29tcpdump -i eth0 ‘port 80’Monitor all traffic on port 80 ( HTTP )
30lsofList all open files on the system
31lsof -u userList files opened by user
32free -hDisplay free and used memory ( -h for human readable, -m for MB, -g for GB.)
33watch df -hExecute “df -h”, showing periodic updates
34idDisplay the user and group ids of your current user.
35lastDisplay the last users who have logged onto the system.
36whoShow who is logged into the system.
37wShow who is logged in and what they are doing.
38groupadd testCreate a group named “test”.
39useradd -c “John Smith” -m johnCreate an account named john, with a comment of “John Smith” and create the user’s home directory.
40userdel johnDelete the john account.
41usermod -aG sales johnAdd the john account to the sales group
42ls -alList all files in a long listing (detailed) format
43pwdDisplay the present working directory
44mkdir directoryCreate a directory
45rm fileRemove (delete) file
46rm -r directoryRemove the directory and its contents recursively
47rm -f fileForce removal of file without prompting for confirmation
48rm -rf directoryForcefully remove directory recursively
49cp file1 file2Copy file1 to file2
50cp -r source_directory destinationCopy source_directory recursively to destination. If destination exists, copy
source_directory into destination, otherwise create destination with the contents of source_directory.
51mv file1 file2Rename or move file1 to file2. If file2 is an existing directory, move file1 into directory file2
52ln -s /path/to/file linknameCreate symbolic link to linkname
53touch fileCreate an empty file or update the access and modification times of file.
54cat fileView the contents of file
55less fileBrowse through a text file
56head fileDisplay the first 10 lines of file
57tail fileDisplay the last 10 lines of file
58tail -f fileDisplay the last 10 lines of file and “follow” the file as it grows.
59psDisplay your currently running processes
60ps -efDisplay all the currently running processes on the system.
61ps -ef | grep processnameDisplay process information for processname
62topDisplay and manage the top processes
63htopInteractive process viewer (top alternative)
64kill pidKill process with process ID of pid
65killall processnameKill all processes named processname
66program &Start program in the background
67bgDisplay stopped or background jobs
68fgBrings the most recent background job to foreground
69fg nBrings job n to the foreground
70ifconfig -aDisplay all network interfaces and ip address
71ifconfig eth0Display eth0 address and details
72ethtool eth0Query or control network driver and hardware settings
73ping hostSend ICMP echo request to host
74whois domainDisplay whois information for domain
75dig domainDisplay DNS information for domain
76dig -x IP_ADDRESSReverse lookup of IP_ADDRESS
77host domainDisplay DNS ip address for domain
78hostname -iDisplay the network address of the host name.
79hostname -IDisplay all local ip addresses
80wget http:// domain .com/fileDownload http:// domain .com/file
81netstat -nutlpDisplay listening tcp and udp ports and corresponding programs
82tar cf archive.tar directoryCreate tar named archive.tar containing directory.
83tar xf archive.tarExtract the contents from archive.tar.
84tar czf archive.tar.gz directoryCreate a gzip compressed tar file name archive.tar.gz.
85tar xzf archive.tar.gzExtract a gzip compressed tar file.
86tar cjf archive.tar.bz2 directoryCreate a tar file with bzip2 compression
87tar xjf archive.tar.bz2Extract a bzip2 compressed tar file.
88yum search keywordSearch for a package by keyword.
89yum install packageInstall package.
90yum info packageDisplay description and summary information about package.
91rpm -i package.rpmInstall package from local file named package.rpm
92yum remove packageRemove/uninstall package.
93tar zxvf sourcecode.tar.gz
cd sourcecode
./configure
make
make install
Install software from source code.
94grep pattern fileSearch for pattern in file
95grep -r pattern directorySearch recursively for pattern in directory
96locate nameFind files and directories by name
97find /home/john -name ‘prefix*’Find files in /home/john that start with “prefix”.
98find /home -size +100MFind files larger than 100MB in /home
99ssh hostConnect to host as your local username.
100ssh user@hostConnect to host as user
101ssh -p port user@hostConnect to host using port
102scp file.txt server:/tmpSecure copy file.txt to the /tmp folder on server
103scp server:/var/www/*.html /tmpCopy *.html files from server to the local /tmp folder.
104scp -r server:/var/www /tmpCopy all files and directories recursively from server to the current system’s /tmp folder.
105rsync -a /home /backups/Synchronize /home to /backups/home
106df -hShow free and used space on mounted filesystems
107df -iShow free and used inodes on mounted filesystems
108fdisk -lDisplay disks partitions sizes and types
109du -ahDisplay disk usage for all files and directories in human readable format
110du -shDisplay total disk usage off the current directory
111cd ..To go up one level of the directory tree. (Change into the parent directory.)
112cdGo to the $HOME directory
113cd /etcChange to the /etc directory
 

Similar Threads

x32x01
Replies
0
Views
125
x32x01
x32x01
x32x01
Replies
0
Views
173
x32x01
x32x01
x32x01
Replies
0
Views
237
x32x01
x32x01
x32x01
  • x32x01
Replies
0
Views
232
x32x01
x32x01
x32x01
  • x32x01
Replies
0
Views
262
x32x01
x32x01
TAGs: Tags
linux commands

Register & Login Faster

Forgot your password?

Latest Resources

Forum Statistics

Threads
517
Messages
519
Members
46
Latest Member
mjhl718
Back
Top