This is an old revision of the document!

Command Line: First tour

  • :!: Read carefully each paragraph before typing commands.
  • :!: Use the TAB completion. Always.
  • :!: Strictly follow the instructions using the suggeste filenames: creativity is not a positive quality for Bash beginners ;)

Follow instructors instructions to log in into your machine. Generally speaking you need to know:

  • The address of the remote machine (can be an IP like or a string like server4 or
  • Your username
  • Your password

Review the page on remote access for further details.

By default, when you log into a remote machine, you'll find yourself welcomed in your home directory. This is a special location dedicated to you, where you can save some files. On a typical set up its path will be /home/username/, but on complex servers with many users this can vary widely. To check your location, use the pwd (print working directory) command:


Remember that the output will be the absolute path of your current location.

While it might sound strange to have identity problems at your young age ;), if you use multiple machines it could be that you have more usernames. So if you are unsure about who you are (i.e. what is your current active username):


What's in your current directory? Try the ls (list) command to see:


Now that you tried the first commands, let's make a step back. The linux shell has a string to tell you it's ready to receive commands. The string is called shell prompt, and can be very minimal, like a simple $, or a more complex thing. As you can guess, it's something we can customize. Usually has a structure like:


That is: username @ machine name : current directory $

The last character is conventionally a dollar sign ($) for regular users, and a sharp (#) for super-user (administrators). In Linux there is only one administrator called root, but some users could have the privilege to impersonate root from time to time.

Also note that the tilda (~) is a shortcut for your home directory.

Remember that you have to wait to see the shell prompt before issuing new commands. If you don't see it, maybe the previous command is stuck or simply still working.

Before moving on with the workshop, we will start using a powerful program for a safer and better work on a remote server: screen.

See: Using screen tutorial

Now try changing directory, that means setting a new working directory:

cd /tmp

Did it work? Test with pwd.

To return quickly to the home directory, you can use cd without specifying the destination path:


See: Introduction to the filesystem