Home > Articles > Operating Systems, Server > Linux/UNIX/Open Source

  • Print
  • + Share This
This chapter is from the book

Getting Started

First have a look at the files in your home folder by running the following command:

username@computer:~$ ls

The ls command lists the files in your current folder. The default command just displays a collection of items that are in your current directory, or location in the filesystem. To make ls more useful, you can type it with options:

username@computer:~$ ls -al

The -al parts are options that can be passed to the command. In this example, two options, a (list all files) and l (use a long display format to display file permissions, dates, sizes, and more), are used with ls to display all of the files (including hidden files) and their details.

Now move to a different directory:

username@computer:~$ cd Desktop

The cd command changes the directory to the place you specify after the command (in this case, the desktop directory). A nice shortcut that you can use when typing files and folders is to type the first few letters and then press the Tab key to fill in the remainder of the file/folder name. As an example, in the previous command, you could type cd Des and press the Tab key to fill in the rest of Desktop (with the / added automatically because it is a directory).

When inside a directory, you may want to have a quick look at the contents of a text file. To do this, use the cat command:

username@computer:~$ cat myfile.txt

This command prints the contents of the file on the screen (a more correct way to say this in computer geek jargon would be “outputs to the screen”).

  • + Share This
  • 🔖 Save To Your Account