1.1 Linux-Commands - 101
1.1 Linux-Commands - 101
Commands                           Explanation
uname -r                           Shows the kernel version (release)
uname -m                           Displays the system architecture
uname -a                           Displays all information that uname can output
lscpu                              Shows details about the CPU
lsmod                              Shows the running kernel modules
modinfo <module name>              Displays detailed information about a kernel module
modinfo -a <module name>           Shows the author of a kernel module
modinfo -d <module name>           Shows a brief description of the kernel module
modinfo -l <module name>           Shows the license under which the kernel module is located
modprobe <module name>             Loads a kernel module into the kernel
modprobe -r <module name>          Unloads a kernel module from the kernel
rmmod <module name>                Unloads a kernel module from the kernel (out of date!)
insmod <path/module name>          Loads a kernel module into the kernel (outdated!)
lspci                              Lists all PCI devices
lspci -v                           Lists all PCI devices in a more detailed view
lspci -vv / lspci -vvv             Lists all PCI devices in an even more detailed view
lspci -k                           Lists all PCI devices, including the modules they use
lsusb                              Lists all USB devices
lsusb -v                           Lists all USB devices in a more detailed view
lsusb -s 002                       Lists only the USB devices on bus 002
lsusb -d <vendor id>               Only shows the USB devices of the respective manufacturer
lsusb -t                           Displays the USB devices in a tree view
pstree                             Shows running processes in a tree view
pstree -p                          Shows running processes including the process ID in a tree view
dmesg                              Reads the kernel ring buffer (kernel boot logs)
journalctl                         Displays all systemd logs
journalctl -k                      Displays all systemd logs related to the kernel
chkconfig --list                   Shows the services that are started automatically, including runlevel (init)
service <process> start            Starts a process (on SysVinit systems)
service <process> stop             Stops a process (on SysVinit systems)
service <process> status           Shows the status of a process (on SysVinit systems)
initctl list                       Shows a list of all init services + their status
initctl start <process>            Starts a process (on upstart systems)
initctl stop <process>             Stops a process (on upstart systems)
initctl status <process>           Shows the status of a process (on upstart systems)
systemctl start <process>          Starts a process (on systemd systems)
systemctl stop <process>           Stops a process (on systemd systems)
systemctl status <process>         Shows the status of a process (on systemd systems)
systemctl list-units                      Lists all systemd units of the system including status
systemctl restart <process>               Restarts a process (on systemd systems)
runlevel                                  Shows in which runlevel you are currently and before
init 3                                    Changes to run level 3
telinit 3                                 Changes to run level 3
systemctl isolate multi-user.target       Changes to the boot target Multi-User.Target (systemd)
systemctl get-default                     Displays the set standard boot target
systemctl set-default multi-user.target   Sets the standard boot target to Multi-User.Target
systemctl isolate reboot.target           Restarts the system
systemctl isolate poweroff.target         Turns off the system
shutdown -r +10                           Restarts the system in 10 minutes
shutdown -c                               Deletes the previously set waiting time and thus the entire command
shutdown -r now                           Immediately restart the system
shutdown -h now                           Shuts down the system immediately
halt                                      Shuts down the system
poweroff                                  Shuts down the system
reboot                                    Reboots the system
wall <message>                            Sends a message through the system to logged-in users
swapon -s                                 Displays the swap partitions or files in use
swapoff -a                                All swap files or swap partitions will be stopped
swapon -a                                 Any swap files or swap partitions will start
lsblk                                     Lists all block devices (hard drives)
df                                        Lists all hard disks including storage space and mount point
blkid                                     Displays the UUID of a hard drive
mount                                     Shows all mounts of the system
pvs                                       Displays the physical volume (PV) (with installed LVM)
vgs                                       Displays the volume groups (VG) (if LVM is installed)
lvs                                       Displays the logical volumes (LV) (if LVM is installed)
grub-install <grub partition>             Installs GRUB Legacy in the corresponding GRUB partition
grub                                      Opens a GRUB shell (legacy)
grub-mkconfig / grub2-mkconfig            Creates a new grub.cfg file (GRUB 2). To do this, manual
                                          Changes have been made in the / etc / default / grub file
update-grub                               Same function as grub-mkconfig, but only on debian systems
                                          available
ldd /path/program                         Shows which libraries the respective program uses
ldconfig                                  Makes new libraries known system-wide
LD_LIBRARY_PATH                           Variable in which a library path can be stored
dpkg -i <program.deb>                     Installs the program <programm.deb>
dpkg --configure <program>                Configures the program <program> (usually not necessary because this
                                          happens automatically during installation)
dpkg-reconfigure <program>                Completely reconfigures <program>
dpkg -L <program.deb>                     Shows in which paths the program would be installed
dpkg -l                                   Shows a list of all installed packages on the system
dpkg -r <program>             Removes <program> from the system. Configuration files are retained!
dpkg -P <program>             Removes <program> including configuration files
dpkg --purge <program>        Removes <program> including configuration files
apt install ./<program.deb>   Installs the <program.deb> downloaded in the current directory,
                              including the corresponding dependencies
apt purge <program>           Removes <program> including all configuration files and dependencies,
                              provided they are not used by other programs
apt update                    Updates the package sources from /etc/apt/sources.list
apt dist-upgrade              Updates the entire Linux system to the latest state
apt upgrade                   Updates the system but does not delete any files. So refuses
                              Service when a file should be deleted
apt full-upgrade              Updates the system and also deletes files if necessary.
apt autoremove                Deletes files that are no longer needed due to a system update
apt-cache search <program>    Searches for <program> in the apt cache
apt-cache depends <program>   Outputs the dependencies of <program> (before the installation!)
aptitude install <program>    Installed <program> with aptitude
aptitude remove <program>     Removes <program> from the system. Configuration files are retained.
aptitude purge <program>      Removes <program> including configuration files from the system.
aptitude search <program>     Searches for the package <program> in the aptitude cache
aptitude                      Starts the graphical user interface of aptitude
rpm -qpl <program.rpm>        Shows in which paths the program would be installed
rpm -qpi <program.rpm>        Displays detailed information on <program.rpm>
rpm -i <program.rpm>          Installs <program.rpm> on the system (dependencies are not
                              resolved independently!)
rpm -qa                       Displays all programs installed on the system
rpm -e <program>              Removes <program> from the system (e = erase)
rpm -U <program.rpm>          Updates <program.rpm> to a newer version
rpm -qf /path/program         Shows from which package /path/program originated
yum update                    Updates the entire system to the latest version (Red Hat systems)
yum search <program>          Searches for <program> in the package sources
yum info <package name>       Provides detailed information on <package name>
yum install <program>         Installed <program> including all dependencies
yum list installed            Displays all programs installed on the system
yum remove <program>          Removes <program> from the system
yum autoremove                Deletes files that are no longer needed due to a system update
yum whatprovides <program>    Shows, among other things, which package <program> originally came from
yumdownloader <program>       Downloads <program> without installing it at the same time
zypper se <program>           Searches for <program> in the package sources (SUSE systems)
zypper install <program>      Installed <program> including all dependencies (SUSE systems)
zypper remove <program>       Removes <program> from the system
zypper list-updates           Displays the updates available for the system
zypper update                 Updates the system to the current status
zypper repos                  Shows the configured package sources from zypper
man 2 <command>               Displays man page 2 of <command>
man 4 <command>               Displays man page 4 of <command>
history                       Displays a history of the most recently entered commands
HISTFILE                      Variable that contains the file in which the history is saved
~/.bash_history               File in which the history is saved
echo $HISTFILE                Outputs the content of the HISTFILE variable
echo -e                       Activates the possibility to output line breaks (\ n) or TAB (\ t), for example
env                           Shows the environment variables including their values in bash
set                           Shows further variables of the shell + different functions
set -x                        Switches on the debug mode of the shell
set +x                        Switches off the debug mode of the shell
unset VARIABLE                Deletes a variable
bash                          Starts another bash in which we are located automatically (child process)
export VARIABLE               Creates a variable that can also be used in child processes
cat file1 file2 > file3       Copies the contents of file1 and file2 to file3
less file1                    Outputs the content of file1 page by page
head <file>                   Displays the first 10 lines of <file>
head -n 20 <file>             Displays the first 20 lines of <file>
tail <file>                   Displays the last 10 lines of <file>
tail -n 20 <file>             Displays the last 20 lines of <file>
tail -f                       Displays the last lines of <file> in real time
zcat <file.gz>                Outputs the content of a gz-compressed file
bzcat <file.bz2>              Outputs the content of a bz2-compressed file
xzcat <file.xz>               Outputs the content of a xz-compressed file
nl <file>                     Opens the text file with line numbers
nl -b a <file>                Empty lines are also given a line number
wc <file>                     Shows the number of lines and words in a document
wc -w <file>                  Only shows the number of words
wc -l <file>                  Only shows the number of lines
od <file>                     Creates a dump of <file> in octal notation
od -c <file>                  Creates a dump of <file> in "normal" notation
od -b <file>                  Creates a dump in binary notation from <file>
od -h <file>                  Creates a dump of <file> in hexadecimal notation
od -a <file>                  Creates a dump of <file> in ASCII notation
md5sum <file>                 Displays the hash value of <file>
md5sum -c <file>              Compares the saved hash value from <file> with the hash value of the
                              Program and outputs a corresponding message
sha256sum <file>              Displays the hash value of <file>
sha512sum <file>              Displays the hash value of <file>
sort <table.csv>              Sorts <table.csv> based on the first number
sort -n <table.csv>           Sorts <table.csv> based on the whole number
sort -t "," -k3 <table.csv>   Sorts <table.csv> based on the data in the third column
uniq <file.txt>                         Deletes identical lines from <file.txt> that are directly below each other
uniq -c <file.txt>                      Deletes identical lines from <file.txt> that are directly below each other
                                        and at the same time shows how often these lines occurred
uniq --group <file.txt>                 Groups identical lines from <file.txt>
cat table.csv | tr ',' ';'              Replaces the commas in table.csv with semicolons
cat table.csv | tr -d ','               Removes the commas from table.csv
cat table.csv | tr 'a-z' 'A-Z'          Replaces lower case letters in table.csv with upper case letters
cut -d ',' -f 4 table.csv               Outputs only the fourth column of table.csv
cut -d ',' -f 1,2,4 table.csv           Outputs columns 1, 2 and 4 of table.csv
paste <file1> <file2>                   Outputs the content of both files separated by TAB (standard)
paste -d ';' <file1> <file2>            Outputs the content of both files separated by a semicolon
paste -d ';' -s <file1> <file2>         Outputs the content of both files line by line, separated by a semicolon
sed 's/colleague/employee/g' tabelle.csv Replaces the word "colleague" in table.csv with the word "employee"
sed -i 's/colleague/employee/g'         Replaces the word "colleague" in table.csv with the word "employee".
tabelle.csv                             This is saved directly in table.csv.
split -b 1000 <file>                    Creates several small files of 1000 bytes each from a large file
pwd                                     Shows the directory in which you are currently located
cd /path/to/directory                   Changes to /path/to/directory
cd ..                                   Changes back one directory in the directory tree
cd ~                                    Changes to the personal home directory
cd -                                    Change to the directory you were in before
cp <file> /tmp                          Copies <file> to /tmp
cp -i <file> /tmp                       Copies <file> to /tmp. If the file already exists there, we asked if we want to
                                        overwrite this
cp -p <file> /tmp                       Copies <file> to / tmp while keeping the time stamp of the source file
cp -r /tmp .                            Copies the directory / tmp including files and subdirectories into the
                                        Directory in which we are currently
mv <file> /tmp                          Moves <file> to the / tmp directory
mv file1 file2                          Renames file1 to file2
touch file                              Creates an empty file named "file" or changes the timestamp of a already
                                        existing file "file"
touch -t 201904011234.21 <file>         Sets the timestamp of <file> to 04/012019 at 12:34 p.m. and 21 Seconds
file <file>                             Shows what kind of file it is (e.g. ASCII text file)
ls                                      Lists the contents of a directory
ls -a                                   Lists the contents of a directory, including hidden files
ls -l                                   Lists the contents of a directory in a detailed view (File permissions, owner,
                                        size, etc.)
ls -lh                                  Lists the contents of a directory in a detailed view. The size of files is
                                        displayed in a readable format, e.g. 1 MB instead of 1000000 bytes
ls -R                                   Shows the content of a directory, including the subdirectories
ls -ltr                                 Sorts the output according to the files last edited. The last edited file is at the
                                        bottom
mkdir test                              Creates a directory called "test"
mkdir test1 test2 test3                 Creates three directories "test1-3"
mkdir -p test4/test5/test6              Creates the directory "test4" and the subdirectory "test5" and its
                                      Subdirectory "test6"
rmdir <directory>                     Deletes (empty) directory
rmdir -p <directory1/directory2>      Deletes <directory 1> and its sub-folder <directory 2>
rm <file>                             Deletes <file>
rm -i <file>                          Before deleting, asks whether we are really sure
rm -v <file>                          Deletes <file> and then issues a success message
rm -f <file>                          <file> is deleted without asking
rm -rf ./<directory>                  Deletes <directory> including subfolders and files
find -name <filename>                 Searches (and finds, if available) <filename>
find /var -name *.log                 Looks for files with the extension .log in the /var directory
find / -maxdepth 4 -name *.log        Searches in / for log files, but only with a maximum of 4 subdirectories
dd if=/dev/sda1 of=/dev/sdb1          Creates an exact image from /dev/sda1 to /dev/sdb1
dd if=/dev/sda of=backup_bootloader   Creates a backup of the bootloader
bs=512 count=1
tar -cf file.tar file1 file2          Creates the archive file.tar from the files file1 and file2
tar -tf file.tar                      Displays the content of the file.tar archive without unpacking it
tar -rf file.tar file3                Inserts file3 into the existing archive file.tar
tar -xf file.tar                      Extract the archive file.tar
tar -xvf file.tar                     Extracts the archive file.tar and outputs a result
tar -cvzf file3.tar.gz file1 file2    Creates a gzip-compressed archive called file3.tar.gz from file1 and file2
tar -tzf file3.tar.gz                 Shows the content of the archive file3.tar.gz compressed with gzip
tar -xzvf file3.tar.gz                Unpacks the gzip-compressed archive file3.tar.gz
tar -cvjf file4.tar.bz2 file1 file2   Creates a bzip2-compressed archive named file4.tar.bz2 from file1 and file2
tar -tjf file4.tar.bz2                Shows the content of the archive file3.tar.gz compressed with bzip2
tar -xjvf file4.tar.bz2               Unpacks the bzip2-compressed archive file4.tar.bz2
tar -cvJf file5.tar.xz file1 file2    Creates an xz-compressed archive called file5.tar.xz from file1 and file2
tar -tJf file5.tar.xz                 Shows the content of the archive file5.tar.xz compressed with xz
tar -xvJf file5.tar.xz                Unpacks the xz-compressed archive file5.tar.xz
ls | cpio -o > content.cpio           Lists the files of the directory in which we are located and directs forward
                                      this to the cpio command in copy out mode. This then creates the packed file
                                      content.cpio
cpio -i < content.cpio                Extracts the content.cpio file
cpio -it < content.cpio               Displays the content of the content.cpio file without extracting it
find . -depth | cpio -pd /tmp/test    Searches for all subdirectories and files in the current directory and sends the
                                      result to cpio. This is called in pass through mode and copies the files to the
                                      /tmp/test directory that is created, if not yet available
gzip file1                            Compresses file1 to file1.gz
gzip file1 file2                      Compresses file1 to file1.gz and file2 to file2.gz
gzip -k file4                         Compresses file4 to file4.gz without deleting file4 afterwards
gzip -d file1.gz                      Extracts file1.gz to file1
gzip -dk file2.gz                     Extract file2.gz to file2 without deleting file2.gz afterwards
gunzip file3.gz                       Extracts file3.gz to file3
bzip2 file1                           Compresses file1 to file1.bz2
bzip2 -dk file1.bz2                   Extract file1.bz2 to file1 without deleting file.bz2 afterwards
bunzip2 file1.bz2                  Extracts file1.bz2 to file1
xz file1                           Compresses file1 to file1.xz
xz -k file22                       Compresses file2 to file2.xz without deleting file2 afterwards
xz -d file2.xz                     Extracts file2.xz to file2
unxz file2.xz                      Extracts file2.xz to file2
ls *.txt                           Shows all files in the current directory that have the file extension .txt in use
ls test*                           Displays all files in the current directory that start with the word test
ls ?.txt                           Shows all files in the current directory whose names consist of only one
                                   Letter and have the file extension.txt
ls ??.txt                          Displays all files in the current directory whose names consist of just two
                                   Letters and have the file extension.txt
ls [tT]est*.csv                    Lists files that begin with test or test and have the file extension .csv
ls test[1-4].txt                   Lists all files that begin with test and immediately afterwards a 1, 2, 3
                                   or 4 follows
ls test[^1-2]                      Lists all files that begin with test and immediately thereafter NONE 1 or
                                   2 follows
ls {table,chair}*                  Lists files that begin with the word table or chair
ls {table,test}[^1-2]*.[Tt][Xx]?   Lists files that begin with table or test, but not with a 1 or 2 continue. The file
                                   extension must begin with T or t and continue with X or x plus any other
                                   character
ls -la / > list.txt                Saves the result in the file list.txt. Possibly previously existing content
                                   this file will be overwritten / deleted
ls -la /bin >> list.txt            Saves the result in the file list.txt. Previously existing content becomes
                                   thus not deleted. The new content is simply attached to the back
ls -la 1> liste2.txt               Forwards the result to the standard output channel. 1 = STDOUT. In in this
                                   case it is the file liste2.txt
ls -zb 2> error.txt                Redirects the STDERR channel to error.txt. I.e. if ls -zb an error outputs, the
                                   error output is saved in the error.txt file
ls -la > liste.txt 2> error.txt    The result is redirected (STDOUT) to the liste.txt file. Possible Error
                                   messages (STDERR) are redirected to the error.txt file
ls -la > liste3.txt 2>&1           Redirects both STDOUT and STDERR to the liste3.txt file
wc -l < file1                      STDIN is not the keyboard at this point, but the file1 that we are at forward
                                   the command wc -l
wc -l file1                        Here we have used the keyboard as the STDIN. The result is the same as with
                                   the STDIN redirection from a file
wc -l 0< file1                     STDIN is not the keyboard at this point, but the file1 that we are at forward
                                   the command wc -l. This is just a different Notation. 0 = STDIN
wc -l << HEREDOC                   Opens an interactive mode in which you can write commands / texts until the
                                   word HEREDOC is written
tr 'a-z' 'A-Z' <<< $VARIABLE       The content of the variable is passed on to tr. tr ensures that the Result is
                                   output in capital letters
ls -la | tee list4.txt             Outputs the result of ls -la on the screen and writes it as well also in the file
                                   list4.txt
ls -la | tee -a list4.txt          Outputs the result of ls -la on the screen and writes it as well also in the file
                                   list4.txt. The old content will not be overwritten.
find *.bak | xargs                 Lists all .bak files side by side
find *.bak | xargs rm              Deletes all .bak files in the corresponding directory
cat xargs-file | xargs             Returns the words from the file xargs-file side by side
xargs -a xargs-file                        Returns the words from the file xargs-file side by side
xargs -a employees.txt | tr 'AZ' 'a-z' >   The employee abbreviations in the employees.txt file are no longer
employees2.txt                             written one below the other, but side by side. The result is passed to tr
                                           which converts the uppercase letters to lowercase letters. The result is saved
                                           in the file employees2.txt
ps -ef                                     Shows all processes that are currently active (detailed)
pstree                                     Shows all processes in a tree view
pstree -p                                  Shows all processes in a tree view, including process ID
top                                        Dynamic overview of all running processes
top -p 1127,1128                           Opens the top program, which in turn only displays the processes with
                                           process IDs 1127 and 1128
free                                       Shows statistics on RAM and SWAP memory
free -m                                    Shows the RAM and SWAP data in megabytes
free -g                                    Shows the RAM and SWAP data in gigagytes
free -b                                    Shows the RAM and SWAP data in bytes
free -h                                    Shows the RAM and SWAP data in the "best" readable format
pgrep nginx                                Displays the process ID of nginx
pgrep -l nginx                             Displays the process ID and name of the nginx process
kill -l                                    Displays all possible kill signals
kill 1152 1153                             Sends the SIGTERM (15) signal to processes 1152 and 1153, resulting in
                                           leads to an orderly shutdown
kill -SIGTERM 1152 1153                    Sends the SIGTERM (15) signal to processes 1152 and 1153, resulting in
                                           leads to an orderly shutdown
kill -15 1152 1153                         Sends the SIGTERM (15) signal to processes 1152 and 1153, resulting in
                                           leads to an orderly shutdown
kill -TERM 1152 1153                       Sends the SIGTERM (15) signal to processes 1152 and 1153, resulting in
                                           leads to an orderly shutdown
kill -9 1152                               Sends the SIGKILL (9) signal to process 1152, causing the Process is
                                           rigorously killed
kill -SIGSTOP 1152                         Sends the SIGSTOP (19) signal to process 1152, causing the process to be
                                           stopped / paused
kill -SIGCONT 1152                         Sends the SIGCONT (18) signal to process 1152, which results in the paused
                                           process is continued
pkill -x nginx                             Sends the SIGTERM (15) signal to the process with the exact name "nginx"
killall -l                                 Shows all signals that killall can send
killall -u manuel                          Kills all processes that run under the user Manuel
STRG+Z                                     Sends the SIGSTOP (19) signal to the process currently running in the
                                           foreground
fg                                         Brings a process paused with SIGSTOP (19) back to the foreground
                                           (Process starts again)
bg                                         Brings a process paused with SIGSTOP (19) into the background (process
                                           starts again)
STRG+C                                     Sends the SIGINT (2) signal to the process currently in the foreground
                                           running, which leads to the terminal connection of the process
                                           interrupted and this is stopped
sleep 500 &                                Starts the sleep program with 500 seconds in the background
jobs                                       Shows the processes in the background
nohup sleep 1000 &                     Starts the sleep program with 1000 seconds in the background. At the
                                       If you log off from the system, the program continues and will not go through
                                       SIGHUB (1) ended
watch uptime                           Runs the uptime program every 2 seconds
watch -n 5 uptime                      Runs the uptime program every 5 seconds
nice -n 5 sleep 1000 &                 Runs the sleep program with 1000 seconds in the background and assigns
                                       the nice value 5
nice sleep 2000                        Starts the sleep program with 2000 seconds and a nice value of 10
                                       (10 = standard)
renice 2 -p 4512                       Assigns a new nice value (2) to a process that is already running with the
                                       Process ID 4512
renice 1 -u manuel                     Gives all processes that run manually under the user a new nice value (1)
ps -efo pid,ni,cmd                     Shows a table with running processes including PID and nice value
grep manuel /etc/passwd                Searches the /etc/passwd file and prints all lines that start with the name
                                       manuel
grep -v manuel /etc/passwd             Searches the /etc/passwd file and prints out any lines that do NOT include the
                                       Name manuel
grep -vn manuel /etc/passwd            Searches the /etc/passwd file and prints out any lines that do NOT include the
                                       Name manuel. In addition, line numbering inserted
grep -o manuel /etc/passwd             Searches the /etc/passwd file and only outputs the words / names that you
                                       was looking for, so in this case manuel
grep -i "^this" regex.txt              Searches the regex.txt file for the word "this", which is, however must be at
                                       the beginning of the line.
grep -i "example$" regex.txt           Searches the regex.txt file for the word "example", which must be at the end
                                       of the line
grep -i "example.$" regex.txt          Searches the regex.txt file for the word "example" +1 anything Character,
                                       which must be at the end of the line
grep -i "example\.$" regex.txt         Searches the regex.txt file for the word "example" and a following point
                                       (must again be at the end of the line)
grep -E "wonder(ful|bra)" regex.txt    Searches the regex.txt file for the words "wonderful" or "wonderbra". grep
                                       must be used in extended mode (-E / egrep)
egrep "wonder(ful|bra)" regex.txt      Searches the regex.txt file for the words "wonderful" or "wonderbra". grep
                                       must be used in extended mode (-E / egrep)
egrep -v "wonder(ful|bra)" regex.txt   Searches the regex.txt file for everything except the words "wonderful"
                                       and "wonderbra"
fgrep "wonder(ful|bra)" regex.txt      Durchsucht die Datei gereg.txt genau nach "wonder(ful|bra)".
vi                                     Starts the vi text editor
vi testfile                            vi starts and at the same time opens testfile or creates it, if it does not exist
:q                                     Closes vi without saving first
:wq                                    Saves and closes vi
:w                                     Saves without closing vi
ZZ                                     Saves and closes vi
:x                                     Saves and closes vi
fdisk -l                               Lists all partitions
fdisk /dev/sdb                         Starts fdisk in interactive mode to edit the hard disk /dev/sdb
mkfs.ext4 /dev/sdb1                    Writes the ext4 file system to the /dev/sdb1 partition
mkfs -t ext4 /dev/sdb1                 Writes the ext4 file system to the /dev/sdb1 partition
lsblk -f                              Shows us the individual hard drives including file systems
mkfs.ext3 /dev/sdc1                   Writes the ext3 file system to the /dev/sdc1 partition
mkfs.ext2 -j /dev/sdc1                Writes the ext3 file system to the /dev/sdc1 partition
mkfs /dev/sdd1                        Writes the ext2 file system to the /dev/sdd1 partition
mkswap /dev/sdb1                      Creates a swap partition (SWAP) in /dev/sdb1
swapon /dev/sdb1                      Mounts the new SWAP partition /dev/sdb1 into the system
gdisk /dev/sdc                        Starts gdisk in interactive mode to edit the hard drive /dev/sdc
parted -l                             Shows the individual hard drives and their partitions
parted /dev/sdc                       Starts parted in interactive mode to edit the hard disk /dev/sdc
du /                                  Lists the space used by each file
du -hs /                              Lists the total used space
du -hs /usr                           Displays the used space of /usr
du -h --max-depth=4 /home             Shows the used space of the files and directories of /home, up to a maximum
                                      of 4 subfolders
df -i                                 Shows the inodes of the partitions
fsck /dev/sdc1                        Checks the file system on /dev/sdc1 for errors if /dev/sdc is not mounted
mke2fs -t ext4 /dev/sdc1              Creates an ext4 filesystem on /dev/sdc1
tune2fs -l /dev/sda1                  Outputs the current file system values
tune2fs -c 100 /dev/sda1              Sets the maximum mount count of /dev/sda1 to the value 100
tune2fs -T 20200501 /dev/sda1         Specifies the last time a file system check was performed
tune2fs -i 5d /dev/sda1               Specifies that a file system check should be carried out every 5 days
xfs_repair -n /dev/sdd1               Checks the XFS file system on /dev/sdd1 and lists errors without repairing
                                      them
xfs_repair -v /dev/sdd1               Checks the XFS file system on /dev/sdd1 and repairs errors
xfs_db /dev/sdd1                      Starts the interactive mode of xfs_db
xfs_fsr /dev/sdd1                     Improves the organization of data in the file system of /dev/sdd1, similar
                                      like a defragmentation
mount -t ext4 /dev/sdb1 /mnt/newhdd   Mounts the partition /dev/sdb1 as ext4 to /mnt/newhdd
umount /dev/sdb1                      Unmounts the /dev/sdb1 partition
umount /mnt/newhdd                    Unmounts the /dev/sdb1 partition
mount -a                              Mounts all partitions listed in the /etc/fstab file
blkid                                 Outputs the UUID, labels, types and PARTUUID of hard disks
systemctl status /hdd2                Queries the status of the mount point /hdd2
systemctl stop /hdd2                  Unmounts the hard drive / partition that is mounted to /hdd2
systemctl start /hdd2                 Mounts the hard drive / partition to /hdd2
chmod 664 file.4711                   Gives the file 664 permission
chmod u=rwx,g=rx,o=rx file.4711       Gives the file 755 permission
chmod u=rwx,go=rx file.4711           Gives the file 755 permission
chmod g+w file.4711                   Adds the Write (w) group permission to the file
chmod 1777 test                       Sets the sticky bit to the test directory. This means that everyone is only
                                      allowed to delete their own files and not others, although they have full
                                      control
chmod 4777 test.sh                    Sets the SetUID bit for the test.sh file. This allows a normal user to start the
                                      script with root rights even though he is not root himself.
chmod 2777 test.sh              Sets the SetGID bit on the test.sh file. This allows a user to use the script
                                with the permissions of the appropriate owner group
chown thomas:thomas file.4811   Sets the owner and the owner group of the file.4811 to thomas
chown :manuel file.4811         Only sets the owner group file file.4811 to manuel
chown -R thomas:thomas tar      Sets the owner and owner group of the tar directory and all Subdirectories
                                and files on thomas
chgrp -R manuel tar             Sets the owner group of the tar directory and all subdirectories and files on
                                manuel
umask -p                        Displays the current umask value
umask 0026                      Changes the umask to the value 0026
umask -S                        Displays the current umask value