- Welcome to the Command Line
- Starting Up the Terminal
- Getting Started
- Building Pipelines
- Running Commands as the Superuser
- Finding Help
- Moving Around the Filesystem
- Manipulating Files and Folders
- System Information Commands
- Searching and Editing Text Files
- Dealing with Users and Groups
- Getting Help on the Command Line
- Searching for Man Files
- Using Wildcards
- Executing Multiple Commands
- Moving to More Advanced Uses of the Command Line
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").