terminal.cab

Commands

Every command the simulator knows: what it is for, how to call it, which options work here and where you learn it.

Shell and scripts

  • alias Defines or shows short names for commands.
  • bash Starts a new shell for a script.
  • clear Clears the terminal.
  • command Runs a command without functions or tells what it is.
  • echo Prints its arguments as text.
  • env Shows the environment or runs a command with a changed one.
  • exit Ends the shell.
  • export Passes variables on to started programs.
  • false Does nothing and always fails.
  • help Shows which commands there are.
  • history Shows the commands typed so far.
  • local Creates variables that belong to one function.
  • logout Ends a login shell.
  • man Shows the manual page of a command.
  • printenv Prints values from the environment.
  • printf Prints text following a format.
  • read Reads a line into variables.
  • return Ends a function or a sourced file.
  • set Sets shell options and positional parameters.
  • sh Starts a new shell for a script.
  • shift Shifts the positional parameters.
  • source also . Reads a file and runs its commands in this shell.
  • test also [ Checks files, strings and numbers.
  • true also : Does nothing and always succeeds.
  • type Tells what a command name stands for.
  • unalias Removes aliases.
  • unset Removes variables.
  • which Shows which program file a command runs.

Files and folders

  • cat Shows the contents of files.
  • cd Changes the directory.
  • cp Copies files and directories.
  • less Shows a file page by page, to scroll and search.
  • ln Creates hard or symbolic links.
  • ls Lists what is in a directory.
  • mkdir Makes directories.
  • mv Moves or renames files.
  • pwd Prints the path of the current directory.
  • readlink Shows where a symbolic link points to.
  • realpath Prints the full path without symbolic links.
  • rm Removes files and directories.
  • rmdir Removes empty directories.
  • stat Shows what an inode records.
  • touch Makes empty files or sets their time to now.
  • truncate Sets the size of a file.

Text

  • awk Processes text line by line with a small program.
  • cut Cuts columns out of lines.
  • diff Compares two files line by line.
  • head Shows the start of files.
  • nl Numbers lines.
  • paste Puts the lines of several files side by side.
  • rev Reverses each line character by character.
  • sed Edits text line by line with a script.
  • sort Sorts lines.
  • tac Prints lines from last to first.
  • tail Shows the end of files.
  • tee Writes its input to the screen and into files.
  • tr Replaces or deletes characters.
  • uniq Merges equal lines that follow each other.
  • wc Counts lines, words and characters.
  • find Finds files by name, size, time and permissions and runs commands on them.
  • grep Finds lines that match a pattern.
  • xargs Turns its input into arguments for a command.

Permissions and ownership

  • chgrp Changes the group of files.
  • chmod Changes file permissions.
  • chown Changes the owner and group of files.
  • groups Shows which groups someone belongs to.
  • id Shows user and group IDs.
  • su Switches to another user.
  • sudo Runs a command as root.
  • umask Shows or sets the mask for new files.

Users

Processes

  • bg Continues a stopped job in the background.
  • fg Brings a job to the foreground.
  • jobs Lists the jobs of the shell: running, stopped and finished ones.
  • kill Sends a signal to a process, usually to end it.
  • killall Ends all processes with a given name.
  • nice Starts a command with a changed priority.
  • nohup Starts a command that keeps running when the terminal closes.
  • pgrep Finds processes by name and shows their PIDs.
  • pidof Shows the PIDs of a running program.
  • pkill Ends processes by name.
  • ps Shows running processes.
  • renice Changes the priority of running processes.
  • sleep Waits for a while, for example sleep 5 for five seconds.
  • top Shows the processes using the most CPU or memory.
  • wait Waits until background jobs are finished.

System and services

  • apt Shows the package database (installing comes in LPIC-1).
  • crontab Manages the crontab, a user's schedule.
  • date Shows the date and time.
  • dmesg Shows the messages of the kernel.
  • dpkg comes in the path LPIC-1
  • free Shows memory: total, used, free, available.
  • hostname Shows the name of the computer.
  • journalctl Shows the entries of the system journal.
  • logger Writes a message to the system journal.
  • swapon Shows the swap areas.
  • systemctl Shows and controls services (start, stop, enable).
  • uname Shows facts about the system.
  • uptime Shows how long the computer runs and its load.
  • vmstat Shows processes, memory and CPU in one line.

Disks and space

  • df Shows how full the file systems are.
  • du Shows how much space files and directories take.
  • findmnt Shows mounted file systems as a tree.
  • lsblk Shows disks and partitions as a tree.
  • mount Shows mounted file systems and remounts them with new options.
  • umount comes in the path LPIC-1

Archives

  • gunzip Unpacks .gz files.
  • gzip Packs files into .gz.
  • rsync Syncs directories on this machine.
  • tar Packs files into an archive and back.
  • zcat Shows the content of .gz files.

Network

  • curl Asks a web service and shows its answer.
  • dig Asks the DNS server about a name.
  • host Shows addresses and mail servers of a name.
  • ip Shows the interfaces, addresses and routes of the computer.
  • ping Checks whether another computer answers.
  • scp comes in the path LPIC-1
  • ss Shows which ports the computer listens on.
  • ssh comes in the path LPIC-1
  • ssh-copy-id comes in the path LPIC-1
  • ssh-keygen comes in the path LPIC-1

Git and Docker