Unix-Utilities
Unix Dienstprogramme
· 5 min read
Unix-Utilities sind ein gut definierter Satz von Befehlen (portable Shell-Skripte, evtl. POSIX spezifiziert). Der Begriff umfasst nicht standardmässige CLI-Befehle (Unix/Linux). 1 2 3 4
Linux Shortcut Keys / Commands
Basic Navigation
cd ..move up one directorycd /go to root directorycd ~go to home directorycdchange directoryclearclear the terminal screenhistoryshow command historyls -alist all files including hiddenls -llist in long formatlslist files and directoriespwdprint working directory
File & Directory Management
~/represent contents in the home directory from the working directoryarcreate library archives, and add or extract filesbasenamedisplay portions of pathnames and filenamescat filenamedisplay file contentscatconcatenate and display filescd ../..switch to a directory two levels highercd ..switch to a directory one levels highercd .represent the current directorycdchange working directorychgrpchange the group ownership of a filechmod 755 filenameChange file permissionschmod u+x filenameMake file executable for userchmodchange the permissions mode of a filechown user:group filenameChange file owner and groupcmpperform a byte-by-byte comparison of two filescommselects or rejects lines common to two sorted filescompresscompress files (see uncompress also)cp -r source_dir destinationcopy directory recursivelycp source destinationcopy filecpcopy filescpiocopy file archives in and outcsha shell with a C-like syntax and advanced interactive featurescutwrite out selected bytes, characters, or fields from each line of a filecut -d: -f1 /etc/passwdsystem users login accountsdfreport free disk space on file systemsdiffdisplay line-by-line differences between pairs of text filesdudisplay the number of disk blocks used per directory or fileexpandexpand TAB characters to SPACE characters (see unexpand)filedetermine the type of a file by examining its contentsfindfind files by name, or by other characteristicsftpfile transfer programgrepsearch a file for a string or regular expressionhead filenameshow first 10 lines of a fileheaddisplay first few lines of specified filesinstallinstall filesless filenameview file contents one page at a timelnmake hard or symbolic links to filesmkdir dirnamecreate a new directorymkdirmake a directorymorebrowse or page through a text filemv oldname newnamerename or move a filemvmove or rename filesnano [Verzeichnis/Datei]- Nano editorodoctal, decimal, hexadecimal, and ascii dumppagebrowse or page through a text filepastejoins lines from one or more filespwddisplay the pathname of the current working directoryrcpremote file copyrevreverse the order of characters in each linerm -r dirnamedelete a directory recursivelyrm filenamedelete a filermremove files or directoriesrmdir dirnameremove an empty directoryrmdirremove directoriessizedisplay the size of an object filesortsort and collate linesspellreport spelling errorssplitsplit a file into piecesstringsfind printable strings in an object file or binarystripremove symbols and relocation bits from an object filetail -f filenamemonitor file in real-timetail filenameshow last 10 lines of a filetaildisplay the last part of a filetarcreate tape archives, and add or extract filesteereplicate the standard outputtftptrivial file transfer programtouch filenamecreate a new empty filetouchupdate the access and modification times of a fileuncompressuncompress files (see compress also)unexpandrestore TAB characters from SPACE characters (see expand)uniqremove or report adjacent duplicate lineswcdisplay a count of lines, words and characterswheredisplay Binär-, Quell- und Man-Dateienwhereis [options] [-BMS directory... -f] name...Binär-, Quell- und Man-Dateien (details) 5 6zcatdisplay compressed files
System Information
df -hShow disk space usagedu -sh *Show directory sizesfree -hShow memory usagehostnameShow or set system hostnamehtopInteractive process viewerlsblkShow block deviceslscpuDisplay CPU informationtopDisplay running processesuname -aShow all system informationuptimeShow system running time
Process Management
bgResume job in backgroundfgBring job to foregroundjobsList background jobskill PIDKill a process by IDkillall processnameKill process by nameps auxDetailed process listpsShow active processes
Networking Commands
curl urlTransfer data from or to a serverifconfigShow network interfacesip addr showDisplay IP addressesnetstat -tulnShow active portsping hostTest connectivityscp file user@host:/pathCopy file to remote serverss -tulnShow listening socketsssh user@hostConnect to remote machine via SSHwget urlDownload file from web
Package Management (Ubuntu/Debian)
dpkg -lList installed packagessudo apt autoremoveRemove unused dependenciessudo apt install packagenameInstall a packagesudo apt remove packagenameRemove a packagesudo apt updateUpdate package listsudo apt upgradeUpgrade all packages
Package Management (RHEL/CentOS)
sudo dnf install packagenameInstall using DNF (newer versions)sudo yum install packagenameInstall packagesudo yum remove packagenameRemove packagesudo yum updateUpdate packages
File Compression & Archiving
gunzip filename.gzDecompress filegzip filenameCompress filetar -cvf archive.tar directoryCreate tar archivetar -xvf archive.tarExtract tar archiveunzip archive.zipExtract zip filezip archive.zip file1 file2Create zip file
User Management
awk -F: '{ print $1}' /etc/passwdsystem users first field onlyidShow user and group infoless /etc/passwd👉🏻 Users in LinuxlogoutLog out current sessionsu usernameSwitch usersudo adduser usernameAdd a new usersudo deluser usernameRemove usersudo passwd usernameChange user passwordwhoShow logged-in userswhoamiDisplay current username
System Shutdown & Reboot
poweroffPower off systemrebootRestart the systemsudo shutdown -r nowReboot immediatelysudo shutdown nowShut down immediately
Search & Find
find /path -name filenameSearch for file by namegrep -r 'pattern' /pathSearch recursively in directorygrep 'pattern' fileSearch text inside filelocate filenameQuickly find files by nameupdatedbUpdatelocatedatabase
Texteditor Nano
Linux beherrschen (Beginner bis Pro):