TechBeamersTechBeamers
  • Learn ProgrammingLearn Programming
    • Python Programming
      • Python Basic
      • Python OOP
      • Python Pandas
      • Python PIP
      • Python Advanced
      • Python Selenium
    • Python Examples
    • Selenium Tutorials
      • Selenium with Java
      • Selenium with Python
    • Software Testing Tutorials
    • Java Programming
      • Java Basic
      • Java Flow Control
      • Java OOP
    • C Programming
    • Linux Commands
    • MySQL Commands
    • Agile in Software
    • AngularJS Guides
    • Android Tutorials
  • Interview PrepInterview Prep
    • SQL Interview Questions
    • Testing Interview Q&A
    • Python Interview Q&A
    • Selenium Interview Q&A
    • C Sharp Interview Q&A
    • PHP Interview Questions
    • Java Interview Questions
    • Web Development Q&A
  • Self AssessmentSelf Assessment
    • Python Test
    • Java Online Test
    • Selenium Quiz
    • Testing Quiz
    • HTML CSS Quiz
    • Shell Script Test
    • C/C++ Coding Test
Search
  • Python Multiline String
  • Python Multiline Comment
  • Python Iterate String
  • Python Dictionary
  • Python Lists
  • Python List Contains
  • Page Object Model
  • TestNG Annotations
  • Python Function Quiz
  • Python String Quiz
  • Python OOP Test
  • Java Spring Test
  • Java Collection Quiz
  • JavaScript Skill Test
  • Selenium Skill Test
  • Selenium Python Quiz
  • Shell Scripting Test
  • Latest Python Q&A
  • CSharp Coding Q&A
  • SQL Query Question
  • Top Selenium Q&A
  • Top QA Questions
  • Latest Testing Q&A
  • REST API Questions
  • Linux Interview Q&A
  • Shell Script Questions
© 2024 TechBeamers. All Rights Reserved.
Reading: Linux Commands Cheat Sheet for Geeks
Font ResizerAa
TechBeamersTechBeamers
Font ResizerAa
  • Python
  • SQL
  • C
  • Java
  • Testing
  • Selenium
  • Agile Concepts Simplified
  • Linux
  • MySQL
  • Python Quizzes
  • Java Quiz
  • Testing Quiz
  • Shell Script Quiz
  • WebDev Interview
  • Python Basic
  • Python Examples
  • Python Advanced
  • Python OOP
  • Python Selenium
  • General Tech
Search
  • Programming Tutorials
    • Python Tutorial
    • Python Examples
    • Java Tutorial
    • C Tutorial
    • MySQL Tutorial
    • Selenium Tutorial
    • Testing Tutorial
  • Top Interview Q&A
    • SQL Interview
    • Web Dev Interview
  • Best Coding Quiz
    • Python Quizzes
    • Java Quiz
    • Testing Quiz
    • ShellScript Quiz
Follow US
© 2024 TechBeamers. All Rights Reserved.
Linux Tutorials

Linux Commands Cheat Sheet for Geeks

Last updated: Feb 25, 2024 10:33 am
By Harsh S.
Share
10 Min Read
Linux Commands Cheat Sheet for Daily Reference
SHARE

Attention Geeks: This ultimate Linux commands cheat sheet has everything you need to master the command line! It covers all the most commonly used commands, from file basics (listing, copying, viewing, searching, and setting permissions) to creating and deleting folders, file compression, networking, processes, systems, and file transfer operations.

Contents
1. File Operations2. File Manipulation3. File Content Viewing4. Linux File Permissions Command Cheat List5. Linux File Search Commands Cheat Sheet6. Compression Commands Cheat List7. Linux Networking Commands Cheat Sheet8. Process Management9. System Information10. Package Management11. File Deletion Commands12. File Transfer Commands Cheat List13. File Permissions (Extended)

Whether you’re a Linux expert or just starting out, save this cheat sheet for future reference. We packed it with practical commands to help you tackle any task, big or small.

Our Linux Commands Cheat Sheet is a great resource for users of all levels, providing quick and easy access to a range of commands for various tasks. It can help you learn new commands and execute them with confidence, making you a more efficient Linux user.

Linux Commands Cheat Sheet

Let’s now dive into finding out the most commonly used Linux commands. In order to help you, we have divided them into different groups. To explain, we have added short examples so that you can easily grasp the usage.

1. File Operations

Below is the Linux commands cheat list covering the day-to-day file operations. It lists down almost every command you would most likely need to run.

Linux CommandDescription
lsList files and directories with detailed information.
ls -lDisplay in long format with file permissions, owner, size, and modification date.
ls -aShow hidden files as well.
ls -lhDisplay human-readable sizes.
ls *.txtList all text files in the current directory.
ls -R /path/to/directoryRecursively list all files and directories in the specified path.
mkdirCreate a new directory to organize files.
mkdir -m 777 shared_folderCreate a directory with specific permissions (e.g., 777 for read, write, and execute for all users).
mkdir -v project1 project2Create multiple directories and show the progress for each.
mkdir -p /path/to/nested/directoryCreate nested directories with parents if they don’t exist.

2. File Manipulation

Here is a list of file manipulation commands to help you in your routine tasks. Also, learn to manage your files more efficiently than ever.

Linux CommandDescription
cpCopy files or directories to a specified location.
cp -i file.txt /backup/Prompt before overwriting an existing file in the ‘/backup/’ directory.
cp -u /source/* /destination/Copy only newer files from ‘source’ to ‘destination’.
mvMove or rename files and directories.
mv -i old.txt new.txtPrompt before overwriting an existing file while renaming.
mv *.txt /backup/Move all text files to the ‘/backup/’ directory.

3. File Content Viewing

Debugging and log analysis are some of the common operations, we have to do on a regular basis. The below Linux commands cheat list will make your life easier.

Linux CommandDescription
catDisplay the content of a file.
cat -n file.txtDisplay line numbers with the content.
cat file1.txt file2.txt >merged.txt Concatenate and merge multiple files into ‘merged.txt’.
headView the beginning lines of a file.
head -n 10 file.txtDisplay the first 10 lines of ‘file.txt’.
head -c 1M file.txtView the first 1 MB of ‘file.txt’.
tailView the last lines of a file.
tail -n 20 file.txtDisplay the last 20 lines of ‘file.txt’.
tail -f /var/log/syslogContinuously display new log entries in 'syslog'.

4. Linux File Permissions Command Cheat List

The below Linux commands will help you in setting up file permissions and groups.

Linux CommandDescription
chmodChange file permissions for users and groups.
chmod g+s shared_folderSet the group ID on execution (newly created files inherit the group of the parent directory).
chmod -R o-rwx /confidential_dataRecursively remove read, write, and execute permissions for others in ‘confidential_data’.
chownChange file ownership.
sudo chown -R root:admin /protected_folderChange ownership of ‘protected_folder’ to ‘root’ user and ‘admin’ group recursively.

5. Linux File Search Commands Cheat Sheet

The below Linux commands cheat list will make your search faster and increase productivity.

Linux CommandDescription
grepSearch for a pattern in files.
grep -n "error" logfile.txtDisplay line numbers with matching results.
grep -r "function()" src/ --include=*.jsSearch for the occurrence of “function()” in JavaScript files only.
findFind files and directories based on various criteria.
find / -type f -iname "*.jpg" -size +1MFind JPEG files larger than 1 MB case-insensitively from the root directory.

6. Compression Commands Cheat List

Working with large data and files, here is a list of Linux commands to organize your data quickly.

Linux CommandDescription
tarCreate or extract tar archives.
tar -czvf archive.tar.gz folder/Create a compressed tar archive of ‘folder/’.
tar -xzvf archive.tar.gz --wildcards '*.txt'Extract only ‘.txt’ files from ‘archive.tar.gz’.
zipCompress files into a zip archive.
zip -r archive.zip folder/ -x "*.txt"Compress ‘folder/’ excluding ‘.txt’ files.

7. Linux Networking Commands Cheat Sheet

Are you experiencing network failures but unable to troubleshoot the issue? Check the below Linux commands cheat list to trace the network problem.

Linux CommandDescription
pingCheck network connectivity.
ping -c 4 google.comSend 4 packets while pinging.
ping -i 2 google.comSet an interval of 2 seconds between packets.
ifconfigDisplay network interface information.
ifconfig eth0 upEnable the ‘eth0’ network interface.
ifconfig eth0 downDisable the ‘eth0’ network interface.

8. Process Management

Do you want to know what processes are running on your system? Or Did any process get hanged? The below commands will help you manage the running processes.

Linux CommandDescription
psShow running processes.
ps -ef | grep sshdFilter and display processes with "sshd" string in the output.
ps -eo pid,ppid,cmd,%mem,%cpuCustomize the output to display process ID, parent process ID, command, memory, and CPU usage.
killTerminate a process.
kill -9 1234Forcefully terminate the process with PID 1234.
killall -r 'myapp.*'Kill all processes whose names match the regular expression 'myapp.*'.

9. System Information

Looking for ways to check the OS version or worried about the free space on the disk? Here are the commands you need to know.

Linux CommandDescription
unameDisplay system information.
uname -mShow the machine hardware name.
uname -oDisplay the operating system name.
dfShow disk space usage.
df -ThDisplay disk space usage with human-readable sizes and file system types.
df -i /dev/sda1Show inode information for the ‘/dev/sda1’ partition.

10. Package Management

Sometimes you need something more than a usual command. Here are the Linux Apt commands you should be using then.

Linux CommandDescription
aptPackage tool for Debian-based systems.
apt-get install package-name Install a package.
apt updateUpdate package lists.
apt search keywordSearch for packages related to a specific keyword.
apt-cache show package-nameShow detailed information about a package.
yumPackage manager for RPM-based systems.
yum update package-nameUpdate a specific package.
yum list installed | grep package-nameCheck if a package is installed.

11. File Deletion Commands

Want to get rid of trash / unwanted files or folders? Check out the below Linux commands.

Linux CommandDescription
rmRemove files or directories.
rm -f large_file.binForcefully remove ‘large_file.bin’ without prompting.
rm -i *.txtInteractively remove all ‘.txt’ files with confirmation.
rmdirDelete an empty directory.
rmdir emptydirDelete 'emptydir' if it’s empty.

12. File Transfer Commands Cheat List

Looking for ways to send data from one machine to another. But data is too large to handle. The below commands will help you.

Linux CommandDescription
scpSecurely copy files between hosts.
scp file.txt user@remotehost:/path/to/destinationCopy ‘file.txt’ to ‘remotehost’.
scp -r remotehost:/path/to/source/destination/Copy files and directories from the 'remotehost' to the current directory.
rsyncSynchronize files and directories.
rsync -av source/ destination/Synchronize ‘source/’ to ‘destination/’.
rsync -e ssh file.txt user@remotehost:/path/to/destination/Synchronize using SSH and copy ‘file.txt’ to ‘remote host’.

13. File Permissions (Extended)

Finally, we have to the end of this tutorial. Here are some of the advanced examples of the chmod command.

Linux CommandDescription
chmodChange file permissions with symbolic notation.
chmod g+s shared_folderSet the group ID on execution (newly created files inherit the group of the parent directory).
chmod -R o-rwx /confidential_dataRecursively remove read, write, and execute permissions for others in ‘confidential_data’.
chmodChange file permissions using octal values.
chmod 644 file.txtSet the read and write permissions for the owner and read-only for the group and others.

Summary – Essential Linux Commands Cheat Sheet

In conclusion, you must have realized that the above Linux commands cheat sheet is your key to mastering the command-line interface. You can refer to it once in a while or when you need it to solve your day-to-day problems and harness the full power of Linux commands.

So what are you waiting for? Save this Linux commands cheat sheet today and take its help from time to time. Lastly, we wish you keep exploring the power of Linux!

You Might Also Like

Basic Linux Commands for Beginners With Examples

How to Use Bash to Replace Character in String

Simple Bash Scripting Tutorial for Beginners

20 Bash Script Code Challenges for Beginners with Their Solutions

Difference Between Git Repository and Directory

TAGGED:Basic Commands for Beginners
Harsh S. Avatar
By Harsh S.
Follow:
Hello, I'm Harsh, I hold a degree in Masters of Computer Applications. I have worked in different IT companies as a development lead on many large-scale projects. My skills include coding in multiple programming languages, application development, unit testing, automation, supporting CI/CD, and doing DevOps. I value Knowledge sharing and want to help others with my tutorials, quizzes, and exercises. I love to read about emerging technologies like AI and Data Science.
Previous Article How to generate number in Java - 10 Ways Generate Random Number in Java – 10 Ways
Next Article python xor or exclusive or operator with examples Python XOR: Bitwise XOR Explained with Examples

Popular Tutorials

SQL Interview Questions List
50 SQL Practice Questions for Good Results in Interview
SQL Interview Nov 01, 2016
Demo Websites You Need to Practice Selenium
7 Sites to Practice Selenium for Free in 2024
Selenium Tutorial Feb 08, 2016
SQL Exercises with Sample Table and Demo Data
SQL Exercises – Complex Queries
SQL Interview May 10, 2020
Java Coding Questions for Software Testers
15 Java Coding Questions for Testers
Selenium Tutorial Jun 17, 2016
30 Quick Python Programming Questions On List, Tuple & Dictionary
30 Python Programming Questions On List, Tuple, and Dictionary
Python Basic Python Tutorials Oct 07, 2016
//
Our tutorials are written by real people who’ve put in the time to research and test thoroughly. Whether you’re a beginner or a pro, our tutorials will guide you through everything you need to learn a programming language.

Top Coding Tips

  • PYTHON TIPS
  • PANDAS TIPSNew
  • DATA ANALYSIS TIPS
  • SELENIUM TIPS
  • C CODING TIPS
  • GDB DEBUG TIPS
  • SQL TIPS & TRICKS

Top Tutorials

  • PYTHON TUTORIAL FOR BEGINNERS
  • SELENIUM WEBDRIVER TUTORIAL
  • SELENIUM PYTHON TUTORIAL
  • SELENIUM DEMO WEBSITESHot
  • TESTNG TUTORIALS FOR BEGINNERS
  • PYTHON MULTITHREADING TUTORIAL
  • JAVA MULTITHREADING TUTORIAL

Sign Up for Our Newsletter

Subscribe to our newsletter to get our newest articles instantly!

Loading
TechBeamersTechBeamers
Follow US
© 2024 TechBeamers. All Rights Reserved.
  • About
  • Contact
  • Disclaimer
  • Privacy Policy
  • Terms of Use
TechBeamers Newsletter - Subscribe for Latest Updates
Join Us!

Subscribe to our newsletter and never miss the latest tech tutorials, quizzes, and tips.

Loading
Zero spam, Unsubscribe at any time.
x