Linux is the software layer on top of the computer hardware and gives the command. Unlike traditional OS such as Windows or Mac, Linux is the securest and doesn’t depend on GUI. Hence userbase needs Linux Commands Cheat Sheet for early introduction.
‘Linux is fun to operate, but it is not easy to operate.’
Daniel j. Barrett
Linux users are much more creative than traditional GUI-based OS users as they have to constantly imagine what the function looks like. On a conventional system, you have GUI (graphical user interface) to click on, making life easy. But it can’t offer flexibility like Linux. For someone into a bit of coding or computer science, Linux is a great choice to learn. This article shared some of the most essential and underdog Linux commands, serving as Linux commands cheat sheets for your daily needs.
We will also be dividing sections, making it easier to browse the article when you’re looking for specific commands.
Linux distro is fascinating, among other things. As most people use GUI-based operating systems, the turnover can get tricky. However, regular practice can get you to speed at no time. Operating Linux with commands is no magic, but you’ll be surprised by the power in those fingers once you get to command tasks with simple controls.
The Linux Commands Cheat Sheet contains:
● Basic & Advanced Linux Commands Cheat Sheet
● Tips and Tricks
● Quick References
Basic & Advanced Linux Commands Cheat Sheet
List and View Files Quickly
ls | To list view files in the present directory |
ls-R | To list view files in sub-directories |
ls-a | List view hidden files in the folder |
ls-al | View detailed file information such as size, location, permission in a list |
Directory Handling
cd or cd ~ | Return to Home directory |
cd .. | To move up a level |
cd | For easy direction to another directory or folder |
cd / | This one is used to view the root directory |
File Modification
cat > filename | For creating new a new file |
cat filename | View contents of a file |
mv filename | Rename the filename |
sudo | To run programs with superuser, or root, or administrator |
rm filename | Delete file |
Hardware Information
dmesg | Enable message on boot |
cat /proc/ cpuinfo | As the name suggests, the command is used to view CPU information |
free -h | View memory information |
lshw | View hardware configuration information in a list |
lsblk | Lists blocked devices |
spci | Available controller information’s alongside host bridge |
lspci -tv | To show available PCI devices in a tree-like diagram |
lsusb -tv | To view available USB devices in a tree-like diagram |
dmidecode | BIOS information on hardware |
hdparm -i /dev/[disk] | Show disk data |
hdparm -tT /dev/[disk] | Perform disk checkup |
badblocks -s /dev/[disk] | Review unreadable disk space |
Search Query
grep [pattern] [X] | Find file pattern where ‘X’ is the file name |
grep -r [pattern] [X] | Find a specific location where ‘X’ is the directory |
locate [X] | Find all files in the directory where ‘X’ is the file name |
find [/folder/location] -name [X] | Find a list of names starting with the letter ‘X’ |
find [/folder/location] -size [X] | Find specific files in folders with a size greater than ‘X’ |
File Compression
tar cf [X.tar] [X] | Create an archive where ‘X’ is the filename |
tar xf [X.tar] | Extract or unzip a file where ‘X’ is the zip |
tar czf [X.tar.gz] | To convert zip to tar where ‘X’ is the file |
gzip [X] | For compressing a to .gz extension where ‘X’ is the filename |
Process Handling
ps | Shows active process information |
pstree | Show process in tree-view |
pmap | Memory usage information in a process |
kill [process_id] | To kill a specific process, similar to ending from Windows taskbar |
bg | Listing and re-running process |
lsof | Show files in the process |
fg | With this command, we can rerun the most recently killed process, similar to ‘undo’ |
pkill [X] | Kill a process where ‘X’ is the name |
killall [X] | Kill all process named ‘X’ |
Package Installation
yum search [keyword] | Find packages easily by keyword |
yum info [X] | Show package info where ‘X’ is the package name |
yum install [X. rpm] | Install the package named ‘X’ |
dnf install [X. rpm] | Installing a package with the help of DNF |
rpm -i [X. rpm] | Installing a package from the local file (-I to include) |
rpm -e [X. rpm] | Remove rpm package (‘-e’ to exclude) |
File Permission
chmod 777 [X] | Giving file permission to all users where ‘X’ is the filename |
chmod 766 [X] | Giving file permission to all groups of users where ‘X’ is the filename |
x | Executing file permission |
w | Adding new permission to write a file |
r | Permission to read the file |
chown [user] [X] | Transfer file ownership where ‘X’ is the filename |
chown [user]: [group] [X] | Transfer group rule over a file where ‘X’ is the filename |
SSH Login
ssh user@host | For connecting to host |
sh host | Secure connection with a host |
ssh -p [X] user@host | Connect to a specific port where ‘X’ is port number |
telnet host | Connect to host via Telnet |
Networking Commands
SSH hostname | Login to remote SSH connection |
Ping hostname=”” | To check network statuses such as ping and response |
dir | Display files in the current directory remotely |
cd “dirname” | Changing directory remotely |
get X | Downloading a file, it can be a link too |
put X | Upload file to a remote computer |
quit | Logout |
VI Editing
i | Insert the cursor |
a | Start writing after the cursor |
A | To start writing at the end of line |
ESC | Terminate insert mode |
u | Undo the last change |
U | Undo the full line |
o | For opening a new line |
dd | Delete the line |
5dd | Delete five lines, the number corresponds to the lines to delete |
Module Management
username -a | To know about the Kernel version and architecture |
lsmod | Find out the running modules |
modinfo X | Get information about the ‘X’ module |
modprobe –remove X | Remove specific module where ‘X’ is the module name |
modprobe X | Load ‘X’ module into the kernel |
Tips and Tricks
The Linux Commands Cheat Sheet is not only your gateway for cool commands but alongside tips and tricks for taking the skill further.
Configuring Linux with new hardware and kernel can become tricky as multiple devices need their configuration. We need to enable modules to load the kernel into a fixed memory size. The first step is to do modules and install them.
make modules | To create new modules |
make moudles_install | To install the module. |
Though most professionals use Linux as their primary OS, many use a virtual environment to live boot Linux images. Both have their advantages and drawbacks. One of the most reported finds is the wrong memory size. Suppose your computer has 16 GB of RAM, but it will only detect 8 Gb. To solve this, we need to set memory parameters.
LILO boot: linux mem=16GB | Parameterizing memory for boot |
Quick References
Here are a few related articles according to search queries
- How to secure Kali Linux and ensure your protection
- Autopsy Kali Linux
- The Ultimate Penetration Testing Command Cheat Sheet for Linux
- The Linux Command Line for Beginners
- Linux Commands with Examples
EndNote
There are tons of Linux Commands cheat sheets, Linux commands guides, online articles, and books; we previewed the most recent and easy-to-implement commands. The description given alongside is specific search options for easy controls.
Sometimes it’s hard to find Linux commands when you don’t know the name or proper reference. So we thought of the concept beforehand and presented a beginner-friendly Linux Commands Cheat Sheet.
Leave a Reply