This is an old revision of the document!


Command Line: First tour

Our main goal is to set up everyone clients, and to get the main tools to work in the future sessions: ability to connect to the remote server, using screen to keep a living session on the remote server.

  • :!: 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 44.20.200.12 or a string like server4 or nasa.org)
  • 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:

pwd

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):

whoami

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

ls

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:

telatin@gmh:~$

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.

Assuming you never used screen on the server, you can create a new session using the command:

screen -S course

More details on this: 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:

cd

Now we are back to our home directory. So we can create a new sub-directory called course:

mkdir course

Our last task is to use the nano editor, so create a new file called ''

More details on this: Introduction to the filesystem