Basic Linux Commands


Information

  • Commands that are applicable to both files and directories typically require additional options when attempting to apply to directories. Please check the options before you apply them.
  • Please refer to the table below for other notations.
    Notation Meaning
    (——-) Additional Options (Not required)
    [——] Required Options
    usage Links to more detailed explanations

Linux filesystem

Command Description Example Man page Usage
ls (option) (directory) View the contents of (directory) ls Link Link
cd (directory) Navigate through (directory) cd Test/ Link Link
mkdir [name] Make a new directory with the name [name] mkdir Test Link
cp (option) [name1] [name2] Copy name1 files/directories to name2 files/directories cp test1 test2 Link
mv (option) [name1] [name2] Move name1 file to name2 file mv file1 Test/file2 Link
rm (option) [name] Delete files/directories called [name] rm file1 Link Link
cat (option) (filename) List [filename] contents cat file1 Link Link

Linux package manager

Before we start…

  1. Commands with the CAUTION! mark shows commands with a risk of resetting the entire server. If you are trying to execute these commands on a lab server or someone else’s server, please get confirmation from the person in charge before you execute them!
  2. The Caution mark is a command that poses a risk of conflict with existing packages. If there is a problem after execution, consider whether this command was the cause of the problem.
  3. Typically, the warning signs above are commands you have to install to use. Just as you need to be careful when installing them on Windows, you need to be careful when installing them on Linux.

Ubuntu

Command Description Example Caution
apt update Check for updates of existing installed packages sudo apt update
apt upgrade Update if there is a package to update sudo apt upgrade CAUTION!
apt install [package] install package and additional packages required by package sudo apt install gcc CAUTION!
apt-cache policy [package] Displays which versions of a package are available from which repo at which priority. apt-cache policy gcc

Others

command description example
man [command] Prints the manual such as the role, usage, and options the command has. RTFM! man cat

Contributors

Name Contribution
raven724 Create file, write information, Linux filesystem, Linux package manager
daniel2231 Translation to english, minor fixes