Linux has many useful and powerful tools right in the command line. In
this sections we have provided examples for the most common commands
you will need but you can find more in depth explanations of most Linux
commands by using the
man command. For example,
man mv will open a
page in your terminal showing usage and explanations of every option
flag you can give the
ls - list the files and directories inside your current directory.
For this command, you do not need any other parameters for it to work.
However, you may want to list items differently. One way of doing this
is by typing
ls -l. This will present the same files you find with a
ls in a list format including more information. What you see
when you run this command may be daunting before you know what this is
showing you. For now, we will focus on the easy list looking format of the
names to the far right. If the first character shown on the far left is
a d, then the name you are looking at is a directory (aka, a folder).
For more information on what the rest of the output means, see
Another command you can use to see everything you have in your folder
(including hidden files) is the
ls -a command.
You may have seen another command flag
-la used with
combines the two previously explained flags, and will list all files and
folders in the directory you are in. The first two folders shown are “.”
and “..” and this signifies the your current directory (“.”) and your
parent or previous directory (“..”). This list also includes hidden
files, which are denoted by a “.” at the front of a file name.
Explanation on what these are can be found later in this section.
pwd - print the name of your current working directory.
cd - change directory, move into other folders so that you can access the information there.
cd ./folderName will move location from your current
location (signified by the dot “.”) to the location of
However, if you are already in the directory of the folder you want to
be in, you can also simply write
On the other hand, if you are looking to move into a folder that is
beyond the folder you are already in, you can type out the specific
directory path. For example, you might type something like this
cd /home/folderName. Another way of getting to a completely different
folder, you can
cd back to the folder you would like to move from. To
accomplish this, you would change your directory back to the previous
folder you came from by typing
mkdir - make directory, make a new folder.
mv - move a file or directory from one place to another. Can also be used to rename a file.
mv <location of source> <location of destination>
And an example of using the
mv command to rename a file.
rm - remove file or directory as described by telling the command line the location of the file or directory you would like to remove.
To remove a file, simply type
To remove a directory will require a flag, depending on whether you have information in the directory already. While the following line works only on empty directories, it might be nice for you to see if you are about to lose something important, so type
rm -d directory
This will give a warning if there is anything in your folder and then you have the chance to go in and see if you truly want it all removed. If you are positive about all the information going away, one way to do it is
rm -r directory
However, this is just one way. In fact, many of these commands are only one way of accomplishing a task. This is just to get you started but there are boundless nuances in accomplishing a task.
[command] *.[file extension]
The wildcard character is used to call a command on specific files. For
example when you say
ls *.docx that means you want to list all and
only files of type
You can also use this character to call commands on filenames.
cp <file source> <file destination>
cp command you can copy files from the command line from one
folder to another. Here we have an example of using the command with the