Difficulty: Beginner
Estimated Time: 10 minutes

Linux utilities

This discussion gives a general view of some of the utilities that are common in Operating Systems, and gives more details on the ones available in Linux.

Please try to follow the order of the commands, as some depend on the previous ones

Don’t stop now! The next scenario will only take about 10 minutes to complete.

Common Utilities

Step 1 of 2

In Linux there is a single file system. Devices are mounted into this file system. (Use the command man mount to find out more.)

Try it:

man mount

Don't forget to press q to exit the man command.

Now, let's create a directory, so type this: mkdir ~/testdirectory, which will be explained later

Navigation

To locate your position as a user of the file system, there is the concept of your current working directory. Linux only has one working directory per command shell.

File and Directory Naming

Relative naming means that files are named from some special directory: . current directory (Linux) .. parent directory (Linux) ~ home directory (some Linux shells) ~user home directory of user (some shells)

Try:

  • cd .
  • cd ..
  • cd ~

If just the name itself is given without any special prefixes (such as /, ., .., ~) then it refers to the file in the current working directory.

Let's go to our directory, type:

cd ~

Basic Utilities

File Copying:

(Lets create a file, run: touch temp.txt for later use)

cp [options] originalfile newfile (file to file) cp [options] files... dir (file to within a directory)

Now let's copy our file to the directory we created cp temp.txt testdirectory

File Renaming

mv [options] original new

  • let go back to our directory: cd ~
  • and let's make sure our file is there: ls
    • you should see testdirectory and temp.txt, otherwise go back make sure you don't skip the previous steps.
  • rename the file: mv temp.txt temp2.txt

File Removal

rm [options] files...

rm temp2.txt