Show Menu

Linux Basics Cheat Sheet by

cheat sheet for basic linux commands and filesystem

Linux files ystem

root directory of the entire file system hirarchy
Essential user command binaries
static files of the boot loader
device files
host-s­pecific system config­uration
user home direct­ories
essential shared libraries and kernel modules
mount point for removable media such as USB
mount point for a tempor­arily mounted filesy­stems
optional commercial software
system binaries
user utilities and applic­ations
shared files over the system
home directory for the root user
these are not all the filesystem direct­ories ,but they're the most important to know

user accounts operations

sudo <co­mma­nd>
do a command as a super user (root)
change the user password
show the current user
show user detaled data
su <us­ern­ame>
switch user
sudo adduser <us­ern­ame>
make new user
sudo adduser <us­ern­ame> <gr­oup­nam­e>>
add existing user to a group
sudo adduser <us­ern­ame> sudo
add the user to the sudoers file (giving him the root privilage)
sudo deluser <us­ern­ame>
delete user account (doesn't remove his files in the home directory remove it yourself)


uname -a
displays detaled system inform­ation
display memory size (total­,used and free sizes)
free -h
display memory size in human readable format
list block devices
badblocks <de­vic­e> -v
searches for bad sectors in device
badblocks /dev/sda1 -v > file
searches for bad sectors in sda1 and put the output in file
the > here is a part of the command

Navigating direct­ories

cd <di­rec­tor­y>
change direct­ory:go to the given directory
cd ~
change directory to home
cd ..
go up one directory
cd -
go to the previous working directory
list directory contents
ls -l
use long listing format
ls -lh
use human readable long listing format
find <file or direct­ory>
searchs for file or directory in the working directory
locate <file or direct­ory>
searchs for file or directory in the whole system
print working directory
the '<' and '>' are not used in the command they're just for making things here obvious

terminal tips

using up and down arrows
navigating throw your command history
searching for previously typed command in your history
clears terminal
view command history
<co­mma­nd> | less
for long output commands: view only one page and give you the ability to navigate through output lines using arrow keys exit using Q
<co­mma­nd> | more
for long output commands: view only one page and give you the ability to navigate through output pages using Enter exit using Q
<co­mma­nd> && <co­mma­nd>
perform two commands one after the other
man <comman or progra­m>
show manual of that program or tool

operations on files and direct­ories

cp <fi­le> <target dir>
copy file to a target directory
mv <fi­le> <target dir>
move file to a target direct­ory,and can be used to rename files
rm <fi­le>
remove file
rm -r <di­r>
remove directory recurs­ively
rm -i
prompt for every removal
rm -v
explain what's being done
nano <fi­le>
a terminal based text editor
chmod <mo­de> <fi­le>
changes mode (permi­ssions) of the file
chmod -R <mo­de> <di­r>
change mode of directory and its contents recurs­ively
chown <ow­ner> file
change owner of the file
chown <ow­ner> : <gr­oup> file
change owner and group of file
mkdir <dir name>
makes new directory
zip <ar­chive name> <files to be archiv­ed>>
make a .zip archive including the selected files
unzip <ar­chi­ve>
extract the archive in the working directory

apt package manager

apt search <pa­ckage name>
search for package in the database
apt show <pa­ckage name>
show detaled inform­ation about the package
sudo apt install <pa­ckage name>
install package, if it's already installed it will search for updates for it,if it's already the last version it tell you that
sudo apt remove <pa­ckage name>
remove installed package
apt list --inst­alled
list installed packages
sudo apt autoremove
remove the packages that has no use
sudo apt update
update packages database
sudo apt upgrade
upgrade installed software
apt is just a front-end for apt-get so it won't be different if you use any of them but for some user interface inhancing


super handy

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Linux Command Line Cheat Sheet
          Linux Every Day Commands Cheat Sheet