Linux commands – (Cheat Sheet)

You can do a lot using just commands on Linux. Through the Terminal, you can type the command that you want and perfume many actions and diagnostics. Depending on the distro you are using, you will have a different shell pre-installed (bash, dash, etc.). They can have small differences, but for the majority of command, they will work the same.
You can also change the shell if you like. Here you can see a Linux commands cheat sheet with the main commands and what they do. 

SYSTEM
HARDWARE
unameInformation about the systemdmesgShow bootup messages
uname -rInformation about the kernel releasecat /proc/cpuinfoCPU information
hostnameSystem’s hostnamecat /proc/meminfoMemory information
hostname –iThe IP of the system’s hostlshwList the hardware components
last rebootSystem reboot historylsbklList block devices
dateCurrent system’s time and datefree –m Shows free memory
timedatectlChange system’s clocklsspci –tvShows list of PCI devices 
calCalendar, month and daylsusb –tvShows list of USB devices
wShows which user is currently loggeddmidecodeShows hardware information from the BIOS
whoamiUser’s informationhdparm -i /dev/xdaShows information about disk data
finger usernameShow information for a particular userhdparm -tt /dev/xda <:code>Performs read speed test (disk)
USERS
badblocks -s /dev/xdaChecks for bad blocks on disk
idShows information about the current userFILES
lastShows last loginls –alList of all files including hidden
whoShows who is logged inpwdShows the current directory’s path
groupadd “admin”Adds “admin” groupmkdir ‘new’Makes new directory called “New”
adduser “michael”Adds “Michael” as a userrm file_nameRemoves the file you wrote
userdel “michael”Deletes “Michael” from usersrm -f filenameRemoves the file you wrote with force
usermodChanges user’s informationrm -r directory_nameRemoves the directory you wrote recursively
PROCESS
rm -rf directory_nameRemoves the directory you wrote recursively and forcefully
psShows active processescp filea filebCopies the content of filea to fileb
ps aux | grep ‘telnet’Seaches the “telnet” process’ id numbercp -r dira dirbCopies dira to dirb recursively. Creates dirb if doesn’t exist
pmapShows processes’ memory mapmv filea filebMoves, renames filea to fileb
topShows all running processesln -s /path/to/file_name   link_nameSymbolic link to file_name
kil pidKills process with a given pidtouch file_nameCreates a new file (file_name)
killall procKills all processes named proccat > file_namePuts standard input into a file
pkill process-nameSends a signal to a process with its namemore file_nameOutputs file’s content
bgResumes background processeshead file_nameShows the first 10 lines of the file
fgForeground for the suspended jobstail file_nameShows the last 10 lines of the file
fg nameForeground for the job “name”gpg -c file_nameEncrypts a file
lsoftList of files that processes have opened gpg file_name.gpgDecrypts a file
renice 19 pidRuns the pid with low priority “19”wcPrints bytes, words ,and line into a file
pgrep nameFind “name” process IDxargsExecutes commands from standard input
pstreeShows processes in a tree modelINSTALL SOURCE (COMPILATION)
INSTALL PACKAGES
./configureChecks the system for the required software for building the program. Creates a Makefile container. 
rpm -i pkg_name.rpmInstalls a rpm packagemakeReads the Makefile to compile the program.
NETWORK
make installInstalls the binaries after the compilation.
ip addr showShows IP addresses and all network interfacesLOGIN
192.168.0.1/24 dev eth0Assigns 192.168.0.1 (IP address) to eth0 (interface)ssh user@hostSecurely connect to host as user
ping  hostPing a host and see the connectionssh -p port_number user@hostSecurely connect to host using a specified port
whois domainShows information about the domainssh hostSecurely connect to the system via SSH default port 22
dig domainDNS information about the domaintelnet hostConnect to host via telnet default port 23
host domainDNS information about the domainDISK USAGE 
netstat -pnltuShows all active listening portsdf -hShows free space on the mounted system
DIRECTORY TRAVERSE
df -iShows free space inodes on file system 
cd ..Up one level in the directoryfdisk  -lShows disk partitions, sizes, and types
cdChanges directory to the Home directorydu  -shShows disk usage in the current directory
cd /testChanges directory to  /testfindmntDisplays target mount point for all filesystems


mount device-path mount-poinMount a device




You can print this Linux commands cheat sheet and use it as much as you like in your job. It could save you time and make you more productive. 

Article Writter By

Tux

Write a Comment

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