fbpx

Linux Cheat Sheet

Linux Cheat Sheet Commands

 

In this page, you will find Basic Linux Commands and important ones in the title of Linux Cheat Sheet Commands. As you know Linux is widely used in Networking World. Network Engineers and system Administrators uses this important operation system commands a lot in their Daily routine or critical operation activities. So, I have created this Linux Cheat Sheet for you to use it during your network or system management activities. Anymore,  you do not search any Linux command on internet. Because you will find what you need on Linux Cheat Sheet Commands. With this Linux command line cheat sheet, you will be faster on your configuration activities like other cheat sheets like Protocol Cheat Sheets, Python Cheat Sheet etc.

 

You can downlod Linux Cheat Sheet Commands in pdf format and use anywehere you need offline. You can also visit ipcisco.com and use these commands here online.

 





System Information Commands

uname -ashows Linux system info
uname -rshows kernel release info
cat /etc/redhat-releaseshows installed redhat version
uptimedisplays system running/life time
hostnameshows system host name
hostname -Ishows ip addresses of the host
last rebootdisplays system reboot history
datedisplays current date and time
caldisplays monthly calendar
mountshows mounted filesy­stems

File Commands

ls -lshows file type and access permission
ls -alists also hidden files
ls -allists files and directories detailly
pwdshows present directory
mkdir directorycreates a directory
rm xyzdeletes file xyz
rm -r /xyzdeletes directory /xyz and its contents recursively
rm -f abcforcefully deletes abc file without confirmation
rm -rf /xyzforcefully deletes directory /xyz recursively
cp aaa bbbcopies aaa file to bbb file
cp -r /xxx /yyycopies /xxx directıry to /yyy directory
mv aaa bbbrenames or moves file aaa to file bbb
touch abccreates an empty file named abc
cat abcused to view file abc
less abcbrowse through a text file abc
head abcdisplays first 10 lines of file abc
tail abcdisplays last 10 lines of file abc
tail -f abcdisplays last 10 lines of file abc and follow it as it grows
tail -F abcoutputs last lines of abc as it changes
file abcgets type of abc
gpg -c abcencrypts file abc
gpg abcdecrypts file abc
gpg abcdecrypts file abc
gpg abcdecrypts file abc
dirshows files in the current directory
put abcuploads file ‘abc’ from local to remote device
get filedownloads file ‘abc’ from remote to local device

ls Options

-ashows all (including hidden)
-Rrecursive list
-rreverse order
-tsort by last modified
-Ssort by file size
-llong listing format
-1one file per line
-mcomma-­sep­arated output
-Qquoted output

Process Management Commands

psdisplays currently running processes
ps PIDgives the status of a particular process
pidofgives the process ID of a process
ps -efdisplays all running processes on the system
ps -ef | grep xyzdisplays process information for xyz
topdisplays and manages the top processes
htopinteractive process viewer (top alternative)
kill pidkills process with process ID of pid
pkill xyzkills process with name xyz
killall abckills all processes named abc
program &starts program in the background
bglists and resumes stopped jobs in the background
fgbrings the most recent background job to foreground.
fg xbrings job x to the foreground
nicestarts a process with a given priority
renicechanges priority of an already running process
pstreedisplays processes in a tree-like diagram
pmapdisplays a memory usage map of processes
lsoflists files opened by running processes

Networking Commands

arpdisplays ARP table of the device
arpwatchdisplays ethernet activity and Ethernet/ip pairings
bmondisplays bandwidth, captures
curlused for for file transfer
dhclientused to analyze clients ip address, subnet mask, gateway, dns server
digused for simple DNS lookup
dstatcollects and shows system resources
ethtoolused to check settings of your NIC
ftpused for for file transfer
hostused for IP-Name matchings
hping3used for packet analyze
ifstatused to monitor network interface statistics
ip addrused to check network interfaces and routing activities
iptablesused for ip packet filtering
iftopdisplays current bandwidth usage
ifup/ifdownused to enable or disable interfaces
iwconfigused to configure wireless interfaces
netstatto check network connections
nloadused as bandwidth monitoring tool
nmapused for security audits
nslookupused also for DNS query
pingused to check reachability
routedisplays IP Routing Table
scpsecured file transfer
sftpsecured file transfer
ssgives detailed information about the sockets
sshused for secure connection
tsharkanalyzing and capturing
tcpdumpused for analyzing and capturing
telnetused for classical unsecure connection
tsharkused for packet analyze
tracepathused for path tracking
tracerouteused for path tracking
wused to check the current system activity
wgetused to download the content of the web servers
whoischecks the whois database and return with IP and Domain info

Help Commands

command -h / command –helpto review all available options of the “command”
info commandto find info documents about the “command”
whatis commanddisplays a single line description about the”command”
$ man UNIXCOMMANDto view detailed man page of the “command”
aproposused to search man pages for available commands on a specific functionality.

User Information Commands

idshows user&group ids of the current user
lastshows the last users logged on
whoamishows who you are logged in as
whoshows who is logged into the system
wshows who is logged in and what they do
groupadd testcreates group “test”
useradd -c “GK” -m Gokhancreates “Gokhan” account with comment “GK”
userdel Gokhandeletes account “Gokhan”
usermod -aG Networkers Gokhanadds account “Gokhan” to the “Networkers” group

File Permissions

chown userchanges ownership of a file/directory
chown user:group filenamechanges user and group for a file or directory
File Permissionsr (read) permission, 4
w (write) permission, 2
x (execute) permission, 1
-= no permission
File Ownerowner/group/everyone
File Permissions Examples777 | Owner, Group, Everyone has rwx permissions

744 | Owner has rwx permission, Group, Everyone has r permission

755 | Owner has rwx permission, Group, Everyone has rx permissions

776 | Owner, Group has rwx permission, Everyone has rw permissions

Search Commands

grep x filesearches for x in file
grep -icase insens­itive search
grep -rrecursive search
grep -vinverted search
grep -oshows only matched part of the file
find /dir/ -name aaa*finds files starting with aaa in dir
find /dir/ -user Gokhanfinds files owned by Gokhan in dir
find /dir/ -mmin 10finds files modifed less than 10 minutes ago in dir
find /home -size +500Mfinds files larger than 500MB in /xyz
find [/folder/location] -name [x]finds file names starting with character x
whereis aaalocates the binary, source, and manual page of aaa
locate abcfinds the location of abc quickly

File Transfer Commands

scp file.txt server:/tmpsecure copy file.txt to the /tmp folder on server
scp server:/var/www/*.html /tmpsecure copy *.html files in /var/www/ directory on server to the local /tmp folder
scp -r server:/var/www /tmpsecure copy all files and directories recursively from server to the current system’s /tmp folder.
rsync -a /home /backups/synchronize /home to /backups/
rsync -avz /home server:/backups/Synchronize files/directories between the local and remote system with compression enabled

Disk Usage Commands

dfshows free hard disk space on the system
df -hshows free and used space on mounted filesystems
df -ishows free and used inodes on mounted filesystems
fdisk -lshows free and used inodes on mounted filesystems
du -shshows total disk usage off the current directory
du -ahshows disk usage for all files and directories in readable format
freeshows free RAM on the system
free -hshows free and used memory
findmntshows target mount point for all filesystem
mount /xyz /abcmounts a device in /xyz to /abc

Compress and Decompress Commands

gzip abccompresses abc file using gzip.
bzip2 abccompresses abc file using bzip2.
zip abc.zip abccompresses abc file into the archive abc.zip.
tar -czvf archive.tar.gz /home/temp2/compresses a full directory with all subdirectories
gzip -d xyz.gzextracts xyz.gz with gzip utility
gunzip xyz.gzextracts xyz.gz with gzip utility
bzip2 -d file.php.bz2extracts xyz.gz with bzip2 utility
bunzip2 file.php.bz2extracts xyz.gz with bzip2 utility
unzip xyz.zipextracts xyz.zip with zip utility
gunzip -c output.txt.gzto view the contents of both files without extracting
tar cf archive.tar directorycreates tar named archive.tar containing directory
tar xf archive.tarextracts the contents from archive.tar
tar czf archive.tar.gz directorycreates a gzip compressed tar file name archive.tar.gz
tar xzf archive.tar.gzextracts a gzip compressed tar file
tar cjf archive.tar.bz2 directorycreates a tar file with bzip2 compression
tar xjf archive.tar.bz2extracts a bzip2 compressed tar file

Install Commands

yum search keywordcompresses abc file using gzip.
yum install abcinstalls abc package
yum info abcdisplays description and summary info about abc package
rpm -i abc.rpminstalls package from local file named abc.rpm
yum remove abcRemove/uninstall abc package
yum list installedllists all installed packages with yum
yum search [keyword]finds a package by a related keyword
yum info [package_name]shows package information and summary
yum install [package_name.rpm]installs a package using the YUM package manager
dnf install [package_name.rpm]installs a package using the DNF package manager
apt-get install [package_name]installs a package using the APT package manager
rpm -i  [package_name.rpm]installs an .rpm package from a local file
rpm -e [package_name.rpm]removes an .rpm package

Hardware Information Commands

dmesgdisplays messages in kernel ring buffer
cat /proc/cpuinfodisplays CPU information
cat /proc/meminfodisplays memory information
lspci -tvdisplays PCI devices
lsusb -tvdisplays USB devices
dmidecodedisplays DMI/SMBIOS from BIOS
hdparm -i /dev/sdadisplays info about disk sda
hdparm -tT /dev/sdaperforms a read speed test on disk sda
badblocks -s /dev/sdatests for unreadable blocks on disk sda
linux-cheat-sheet-ipcisco





What is Linux?

 

Linux is the most important operating system in Networking World. Many Network Engineers, Network Administrators and Network Technicians use Linux in different areas of Computer Networking.  They use different commands of Linux everyday. But sometimes, some commands can be forgotten. To overcome this issue, I have created a Linux Cheat Sheet for you! In this page, you will find Linux Cheat Sheet Commands.

 

 

Is Linux an Operating System?

 

Because of the fact that there are many versions, “is Linux a Opearing Sytem?” quesiton is very common. The answer is certainly Yes! Linux is an Open source Unix ilke Operating System. It is based on Linux Kernel. This Linux kernel was firstly released by Linus Torvalds at 17 September 1991. There are different distributions of Linux, some of these are:

 

  • Red Hat
  • Ubuntu
  • Fedora
  • Debian
  • Suse etc.

 

All these Linux versions uses the same Linux commands and all the Basic Linux commands are similar in these Operating Systems. Linux find command, Linux delete command, Linux add user, Linuc copy file, Linux password change, Linux unzip etc. All these commands are similar in these versions. So, you can use Linux Cheat Sheet Commands on all these Linux distributions. In other words, you can benefit Linux command line cheat sheet on Red Hat, Ubuntu, Fedora, Debian, Suse etc.

 

Basic Linux Commands

 

There are thousands of commands in Linux. But some of these Linux commands are used very often. We can say these Linux commands, Basic Linux commands. So, what are the Linux Basic Commands? These basic commands are the ones, that Network engineers, System Administrators use almost everyday or very often. Some of the jobs used with these commands are given below:

 

  • linux remove directory
  • linux delete directory
  • linux delete file
  • Linux password change
  • Linux unzip
  • linux copy directory
  • linux add user to gorup
  • linux add user
  • linux copy file
  • linux list users
  • linux search file etc.
  • linux user list
  • linux traceroute
  • linux grep
  • linux create user
  • linux create file
  • linux move file etc.

 

So, in this Linux Cheat Sheet, you can find all these Basic Linux Commands beside the other important Linux Commands. So, Linux Cheat Sheets Commands will help you both on your daily routine system administration activities  and other operational activities.

download-linux-cheat-sheet-ipcisco

Linux Cheat Sheet Commands pdf

 

As the other Cheat Sheets on IPCisco.com, you can also download Linux cheat sheet commands in pdf format. You can both check these Linux commands onthis page and you can download to use offline in any other platform. So, Linux Cheat Sheet pdf is for you. YOu can use it and share with your friends to use also on their Linux activities.

 

If You Like, Kindly Share

 

If you find this page useful for your Linux works and if you like it, kindly share this page with your friends, with your colleagues, with your social media followers etc. Whoever you share this knowledge, this will help us to develop better cheat sheets.

 

You can share this page in your social media accounts like facebook, linkedin, twitter etc., in related network and programming forums, in your blogs, in any of your accounts. If you share this page, this page will help another network, programming fan and it eases his/her work. So, if you would like to help others, kindly share this page.

 

Do not forget, Knowledge Increases by Sharing.

 

linux-commands-cheat-sheet-ipcisco.jpg

8 Responses to “Linux Cheat Sheet”


Leave a Reply

Your email address will not be published. Required fields are marked *