Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
15 views

Basic Linux Commands Cheat Sheet

Uploaded by

yiyav67176
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Basic Linux Commands Cheat Sheet

Uploaded by

yiyav67176
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

11/13/24, 10:03 AM Basic Linux Commands Cheat Sheet [Free PDF Download]

Home > Essential Linux Cheat Sheets >

Basic Linux Commands Cheat Sheet [Free


PDF Download]
Written by Reviewed by
Lamisa Musharrat Md. Ashakul Islam Sowad

Last updated: Feb 19, 2024

LINUX
FUNDAMENTALS
A Complete Guide for Beginners

Enroll Course Now

Enroll Course Now

Linux command is a set of instructions for carrying out a certain action in


Linux. In this article, I will illustrate a basic Linux commands cheat sheet to
make your journey with the Linux command line easier. Type these
commands into the terminal to handle everything from files and directories
to processes and more.

Table of Contents

Download Basic Linux Commands Cheat Sheet


https://linuxsimply.com/cheat-sheets/basic-linux-commands/ 1/22
11/13/24, 10:03 AM Basic Linux Commands Cheat Sheet [Free PDF Download]

Available Download
Options

Most Popular

 PDF (2 Pages)

 DOC (2 Pages)

Combo Pack

 ZIP (pdf, docx, png)

What is a Linux Command?

A Linux command is a text-based interface that allows you to communicate


with the Linux operating system. The commands are inserted into a terminal
which is then passed to a shell that tells the operating system what to do.
Linux command is a great alternative to Graphical User Interface (GUI) as it

https://linuxsimply.com/cheat-sheets/basic-linux-commands/ 2/22
11/13/24, 10:03 AM Basic Linux Commands Cheat Sheet [Free PDF Download]

is much faster and more efficient. You can perform all tasks with commands
that can be done using the GUI.

Basic Linux Commands List


Here I have categorized all the basic commands in Linux. You can also find
that some commands are mentioned with their necessary options. For your
better understanding, the structure of a Linux command is

Command -options arguments parameters

File and Directory Management

In this category, you will find commands that can be used to copy, make,
and remove files; create directories; and navigate through these.

Command Description

cp Copies files and directories

pwd Prints the current working directory

cd Changes current directory

cd.. Changes to the parent directory

cd – Changes to the previous directory

cd ~ Changes to the home directory

ls Lists contents of the current directory

Lists the files and directories in the current working


ls -l
directory in long format

ls -a Lists all files and directories including the hidden ones

ls -r Lists files/directories in reverse

mkdir Creates a new directory

rmdir Removes an empty directory

mv Moves or renames a file /directory

https://linuxsimply.com/cheat-sheets/basic-linux-commands/ 3/22
11/13/24, 10:03 AM Basic Linux Commands Cheat Sheet [Free PDF Download]

Command Description

rm Removes a file/directory

rm -i Prompts system confirmation before deleting

rm -r Deletes a file/directory recursively

rm -d Deletes empty folders

File Manipulation

Under this section, you can find commands which will assist you in editing
your files and show contents in your desired ways.

Command Description

touch Creates an empty file/modify timestamp

cat Concatenates and prints file contents

cat -n Displays the contents of a file along with line numbers

tac Concatenates and prints file contents in reverse order

less Shows contents in a scrollable manner

head Displays the first ten lines of a file

tail Displays the last ten lines of a file

grep Searches for a specified pattern in one or more files

nano Edits and creates files

diff Compares two text files

sort Sorts lines of a text file

sort -r Sorts file reversely

sort -u Removes duplicates and sorts unique values

Permissions

Here, you will get to know how you can change the permission of a file or
directory:

https://linuxsimply.com/cheat-sheets/basic-linux-commands/ 4/22
11/13/24, 10:03 AM Basic Linux Commands Cheat Sheet [Free PDF Download]

Command Description

Modifies a file or directory’s read, write, and execute


chmod
permissions

Changes the ownership of a file, directory, or symbolic


chown
link to a specified username.

chgrp Changes the group ownership of a file or directory

Control System

This section consists of commands that can be used to control the operating
system just by using the command line.

Command Description

poweroff Shuts down the system

reboot Restarts the system

shutdown Shuts down or reboots the system

System and Process Management

Commands for system and process management are:

Command Description

Allows a user to run a command with the privileges of


sudo
another user

ps Lists the running processes on a system

kill Terminates running processes on a system

killall Terminates all processes with a specified name

Displays the amount of disk space used and available on


df
a file system

du Estimates file space usage


https://linuxsimply.com/cheat-sheets/basic-linux-commands/ 5/22
11/13/24, 10:03 AM Basic Linux Commands Cheat Sheet [Free PDF Download]

Package Installation

Commands for package installation are:

Command Description

apt install Installs software packages from the Ubuntu package

[package] repository

Performs package management tasks such as installing,


apt-get install
upgrading, and removing packages

File Compression

Commands for file compression are:

Command Description

tar Creates, views, and extracts files from an archive file

Creates, views, and extracts files from a compressed


zip
archive file

Extracts files from a compressed archive file in the ZIP


unzip
format

gzip Compresses files or directories to reduce their size

bzip2 Compresses files or directories to reduce their size

Search

If you are searching for a pattern in a file content or want to locate files in
your system these basic commands are here to help you.

Command Description

https://linuxsimply.com/cheat-sheets/basic-linux-commands/ 6/22
11/13/24, 10:03 AM Basic Linux Commands Cheat Sheet [Free PDF Download]

grep ‘pattern’ Searches for a specified pattern or regular expression in

files one or more files and display the matching lines

Searches for a specified pattern or regular expression


grep -r
recursively in a directory and its subdirectories, and
pattern dir
display the matching lines.

locate Locates files and directories on the system

find Locates files and directories on the system

find -empty Searches for empty files

Help Documentation

Linux has huge commands and options to offer. It’s ok if you can’t memorize
all these. Use the built-in documentation command to get help.

Command Description

man Displays the manual page of a command or utility

System Information

Commands to get system information are:

Command Description

date Displays and sets system date and time

cal or ncal Displays the calendar of the current month

who Displays information about currently logged-in user

whoami Displays the user name of the current user logged in

Displays information about the current system and


uname
operating system

hostname Displays or set the hostname of the current system

Queries or modifies the hostname and related settings of


hostnamectl
the current system
https://linuxsimply.com/cheat-sheets/basic-linux-commands/ 7/22
11/13/24, 10:03 AM Basic Linux Commands Cheat Sheet [Free PDF Download]

Displays a list of previously executed commands in the


history
terminal

history -c Clears the history list of previously executed commands

Shows information about both total and available space


df
on a file system

User Management

You can easily add or remove a user in your system using the following
commands.

Command Description

useradd Creates a new user account on the system

userdel Deletes a user account from the system

passwd Changes a user’s password

groupadd Adds a new group to the system

groupdel Deletes an existing group from the system

Displays the user and group IDs associated with the


Id
current user

su Switches to another user account

Miscellaneous

Finally, we have listed more commands that may help you in your Linux
journey.

Command Description

Displays a line of text or a variable value on the


echo
command line

clear Clears the terminal window

https://linuxsimply.com/cheat-sheets/basic-linux-commands/ 8/22
11/13/24, 10:03 AM Basic Linux Commands Cheat Sheet [Free PDF Download]

Counts the number of lines, words, and characters in a


wc
file

vim Texts editor for editing text files

ping Checks the connectivity between two network devices

exit Exits the current shell session

htop Displays the system’s process real-time process activity

shred Securely deletes the files by overwriting multiple times

Displays information about the currently logged-in users


w
and their activities

ps Displays the running processes

whatis Displays a brief description of a command

wget Downloads files from the internet

Conclusion
If you are just starting or are still in the learning phase with Linux, these are a
few basic commands you will need to know. Furthermore, these commands
were comprehensive enough to cover virtually every job performed from the
Linux command line.

People Also Ask

What are the basic commands of Linux?

Some basic Linux commands are as follows:

ls: Lists files & directories.

cd: Changes directory.


pwd: Prints current working directory.

cp: Copies files and directories.

mv: Moves and renames files or directories.

rm: Removes files or directories.

mkdir: Creates directories.


https://linuxsimply.com/cheat-sheets/basic-linux-commands/ 9/22
11/13/24, 10:03 AM Basic Linux Commands Cheat Sheet [Free PDF Download]

rmdir: Removes empty directory.

cat: Displays file contents.

echo: Displays a message or a variable.


grep: Searches for a pattern in a file.

chmod: Changes file permissions.

chown: Changes file ownership.

What is sudo in Linux?

In Linux, sudo stands for superuser do, it allows users to execute commands
as a superuser. And superuser is the root user in the Linux system having the
administrative privileges to perform different actions that regular users can
not do.

Which is the best Linux?

There is no straightforward answer to this question. In fact, it depends on your


project’s needs and your personal preferences. Some popular Linux
distributions include Ubuntu, Fedora, Arch Linux, CentOS, etc.

5/5 - (5 votes)

Linux Cheat Sheets


linux commands cheat sheets

Lamisa Musharrat

https://linuxsimply.com/cheat-sheets/basic-linux-commands/ 10/22

You might also like