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-