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