Skip to main content
Engineering LibreTexts

01-B.16: Let's Look at the Basics

  • Page ID
    26792
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    Some Basic Commands

    There are some basic commands that are useful when one is new to the Linux realm. Some of these commands will be covered in greater detail as we move through this journey. We discuss some of the basics here.

    Command Name Command Description Examples
    ~ (tilde) This symbol stands for your home directory. If you are pbmac, then the tilde (~) stands for /home/pbmac
    pwd The pwd command will allow you to know in which directory you're located (pwd stands for "print working directory"). In some instances "pwd" in the Desktop directory will show "~/Desktop". The GNOME Terminal also displays this information in the title bar at the top of its window.
    ls The ls command will show you ('list') the files in your current directory. Used with certain options, you can see sizes of files, when files were made, and permissions of files. "ls ~" will show you the files that are in your home directory. "ls /var/log" will show you the files in the /var/log directory
    cd The cd command will allow you to change directories. When you open a terminal you will be in your home directory. To move around the file system you will use cd.
    • To navigate into the root directory, use "cd /"

       

    • To navigate to your home directory, use "cd" or "cd ~"

       

    • To navigate up one directory level, use "cd .."

       

    • To navigate to the previous directory (or back), use "cd -"

       

    • To navigate through multiple levels of directory specify the full directory path that you want to go to. "cd /var/www" will take you to the /www subdirectory of /var/. "cd ~/Desktop" will move you to the Desktop subdirectory inside your home directory.

       

    cp The cp command will make a copy of a file. "cp bar foo" will make an exact copy of "bar" and name it "foo", but the file "bar" will still be there. If you are copying a directory, you must use "cp -r directory foo" (copy recursively). ("recursively" means to copy the directory and all its files and subdirectories and all their files and subdirectories of the subdirectories and all their files, and on and on, "recursively")
    mv The mv command will move a file to a different location or will rename a file - the original file will be removed. "mv bar foo" will rename the file "bar" to "foo." "mv foo ~/Desktop" will move the file "foo" to your Desktop directory, but it will not rename it. You must specify a new file name to rename a file.
    rm Use this command to remove or delete a file in your directory. "rm foo" will delete the file "foo"
    rmdir The rmdir command will delete empty directories. To delete a directory and all of its contents recursively, "rm -r directoryname"
    mkdir The mkdir command will allow you to create directories. "mkdir music" will create a directory called "music" in the current directory.

    This is by no means an exhaustive list of basic commands, but this will get you started so you can begin to navigate around the system a bit.

    "UsingTheTerminal" by Chris Perry, Ubuntu Community Help Wiki is licensed under CC BY-SA 3.0


    This page titled 01-B.16: Let's Look at the Basics is shared under a CC BY-SA 4.0 license and was authored, remixed, and/or curated by Patrick McClanahan.

    • Was this article helpful?