Linux Basics Cheat Sheet
by m_ashraf via cheatography.com/84329/cs/19923/
Linux files ystem user accounts operations other (cont)
/ root directory of the entire file sudo <co‐ do a command as a super badblocks searches for bad sectors in
system hirarchy mmand> user (root) /dev/sda1 -v sda1 and put the output in
/bin/ Essential user command binaries passwd change the user password > file file
/boot/ static files of the boot loader whoami show the current user the > here is a part of the command
/dev/ device files who show user detaled data
Navigating directories
/etc/ host-specific system configuration su <usern‐ switch user
ame> cd <director‐ change directory:go to the
/home/ user home directories
y> given directory
/lib/ essential shared libraries and sudo make new user
adduser cd ~ change directory to home
kernel modules
<username> cd .. go up one directory
/media/ mount point for removable media
such as USB sudo add existing user to a group cd - go to the previous working
adduser directory
/mnt/ mount point for a temporarily
<username> ls list directory contents
mounted filesystems
<groupnam‐
/opt/ optional commercial software ls -l use long listing format
e>>
/sbin/ system binaries ls -lh use human readable long
sudo add the user to the sudoers
listing format
/usr/ user utilities and applications adduser file (giving him the root
find <file or searchs for file or directory
/usr/s‐ shared files over the system <username> privilage)
directory> in the working directory
hare/ sudo
locate <file searchs for file or directory
/root/ home directory for the root user sudo deluser delete user account
or directory> in the whole system
<username> (doesn't remove his files in
these are not all the filesystem directories
the home directory remove pwd print working directory
,but they're the most important to know
it yourself) the '<' and '>' are not used in the command
they're just for making things here obvious
other
uname -a displays detaled system
information
free display memory size
(total,used and free sizes)
free -h display memory size in
human readable format
lsblk list block devices
badblocks searches for bad sectors in
<device> -v device
By m_ashraf Published 24th June, 2019. Sponsored by CrosswordCheats.com
cheatography.com/m-ashraf/ Last updated 24th June, 2019. Learn to solve cryptic crosswords!
Page 1 of 2. http://crosswordcheats.com
Linux Basics Cheat Sheet
by m_ashraf via cheatography.com/84329/cs/19923/
terminal tips operations on files and directories apt package manager
using up navigating throw your cp <file> <target copy file to a target apt search search for package in the
and down command history dir> directory <package database
arrows mv <file> move file to a target name>
ctrl+R searching for previously typed <target dir> directory,and can be apt show show detaled information
command in your history used to rename files <package about the package
clear clears terminal rm <file> remove file name>
history view command history rm -r <dir> remove directory recurs‐ sudo apt install package, if it's already
ively install <pa‐ installed it will search for
<comma‐ for long output commands:
ckage updates for it,if it's already
nd> | less view only one page and give rm -i prompt for every
name> the last version it tell you that
you the ability to navigate removal
through output lines using sudo apt remove installed package
rm -v explain what's being
arrow keys exit using Q remove
done
<package
<comma‐ for long output commands: nano <file> a terminal based text
name>
nd> | view only one page and give editor
more you the ability to navigate apt list -- list installed packages
chmod <mode> changes mode (permi‐
through output pages using installed
<file> ssions) of the file
Enter exit using Q sudo apt remove the packages that
chmod -R <mo‐ change mode of
<comma‐ perform two commands one autoremove has no use
de> <dir> directory and its
nd> && after the other sudo apt update packages database
contents recursively
<comma‐ update
chown <owner> change owner of the file
nd> sudo apt upgrade installed software
file
man show manual of that program upgrade
chown <owner> change owner and
<comman or tool
apt is just a front-end for apt-get so it won't
: <group> file group of file
or progra‐
be different if you use any of them but for
m> mkdir <dir makes new directory
some user interface inhancing
name>
zip <archive make a .zip archive
name> <files to including the selected
be archived>> files
unzip <archive> extract the archive in the
working directory
By m_ashraf Published 24th June, 2019. Sponsored by CrosswordCheats.com
cheatography.com/m-ashraf/ Last updated 24th June, 2019. Learn to solve cryptic crosswords!
Page 2 of 2. http://crosswordcheats.com