List of (Semi-)Common Linux Commands ==================================== Getting help (besides Googling): - ``man``: shows the manual pages of a command, use :kbd:`q` to quit it, use :kbd:`/` to go to search mode. After typing something to search for, press :kbd:`Enter` and then use :kbd:`n` (or :kbd:`N`) to go to the next (or previous) occurrence. - ``--help``: a flag for most commands, used to give a description of the command and its flags (e.g. ``touch --help``). Basic navigation, file handling, and terminal usage: - ``pwd``: print name of current/working directory. - ``ls``: list directory contents. - ``ls -a``: also hidden files. - ``cd``: change directory. - ``mkdir``: make a new directory in current directory. - ``rmdir``: remove empty directory . - ``rm``: remove files. - ``rm -r``: remove directory and the files contained in it (recursively). - ``cp``: copy a file or directory. - ``mv``: moves files and directories, can also be used to rename files ("move a file to a new name``). - :kbd:`tab`: auto complete commands, flags, files, folders, flags, ... almost anything. - ``touch``: create an empty file, or update modification timestamp on a file. - ``chmod``: change permissions for a file, such as read and write access. - ``locate``: locate files/folders (may not be installed as default). Requires running ``updatedb`` reqularly to update the search index. - ``find``: find files/folders in the current working directory or subdirectories. Does not require ``updatedb``. - ``clear``: clear terminal window (scroll it). Less basic file and data manipulation: - ``echo``: print a string either to console or a file. - ``cat``: concatenate files and print on the standard output. - ``less``: show files/input in a scrollable way. Use :kbd:`q` to quit. - ``tar``: compress/extract files to/from ``.tar.gz`` files. Similar to ``zip``/``unzip``. - ``zip``: compress files to a ``.zip`` file. - ``unzip``: extract files from ``.zip`` files. - ``wc``: count lines, words, bytes. - ``grep``: print lines that match patterns. - ``sed``: filter and transform text. - ``diff``: compare files line by line (``diff -u`` produces a, perhaps, easier to read format). Editors: - ``nano``: a very basic terminal-based text editor. Use :kbd:`Ctrl` + :kbd:`x` to quit. - ``vim``: an advanced terminal-based text editor. Use :kbd:`:q` :kbd:`Enter` to quit. - ``emacs``: an advanced terminal-based text editor. - ``gedit``: a graphical text editor. Informational commands: - ``df``: check the disk space usage on your system. - ``du``: check the disk space usage for all files in the current directory. - ``uname``: print system information (often called as ``uname -a``). - ``hostname``: display the DNS name of your system. - ``ping``: check if a IP address is live. Can also be used on URLs. Administration: - ``sudo``: run commands with administrative or root privileges. - ``apt`` (or ``apt-get``): command for installing software on Ubuntu (also in WSL). Program (job) control and information: - :kbd:`Ctrl` + :kbd:`c`: stop a program. - :kbd:`Ctrl` + :kbd:`z`: suspend a program. - ``fg``: continue a suspended program. - ``jobs``: display status of programs (in this terminal). - ``top``: display currently running programs on the computer with CPU and memory usage. Use :kbd:`q` to quit. - ``ps``: list currently running programs on the computer.