Shell Commands

Command Line (CLI)

Shell Commands
Special CharacterDescription
\dDate (Mon Feb 6)
\D{%Y-%m-%d}Date (YYYY-MM-DD)
\HFull hostname
\jNumber of jobs managed by the shell
\nNewline
\rCarriage return
\sName of the shell
\tCurrent time 24-hour (HH:MM:SS)
\TCurrent time 12-hour (HH:MM:SS)
\@Current time
\uCurrent username
\wFull path of the current working directory

 

Linux Systems
CommandDescription
whoamiDisplays current username.
idReturns users identity
hostnameSets or prints the name of current host system.
unamePrints basic information about the operating system name and system hardware.
pwdReturns working directory name.
ifconfigThe ifconfig utility is used to assign or to view an address to a network interface and/or configure network interface parameters.
ipIp is a utility to show or manipulate routing, network devices, interfaces and tunnels.
netstatShows network status.
ssAnother utility to investigate sockets.
psShows process status.
whoDisplays who is logged in.
envPrints environment or sets and executes command.
lsblkLists block devices.
lsusbLists USB devices
lsofLists opened files.
lspciLists PCI devices.
Files and Directories
OptionDescription
-type fHereby, we define the type of the searched object. In this case, 'f' stands for 'file'.
-name *.confWith '-name', we indicate the name of the file we are looking for. The asterisk (*) stands for 'all' files with the '.conf' extension.
-user rootThis option filters all files whose owner is the root user.
-size +20kWe can then filter all the located files and specify that we only want to see the files that are larger than 20 KiB.
-newermt 2020-03-03With this option, we set the date. Only files newer than the specified date will be presented.
-exec ls -al {} \;This option executes the specified command, using the curly brackets as placeholders for each result. The backslash escapes the next character from being interpreted by the shell because otherwise, the semicolon would terminate the command and not reach the redirection.
2>/dev/nullThis is a STDERR redirection to the 'null device', which we will come back to in the next section. This redirection ensures that no errors are displayed in the terminal. This redirection must not be an option of the 'find' command.