Linux terminal - getting around

From Computer Science
Revision as of 16:16, 10 January 2020 by Jkinne (talk | contribs)
Jump to: navigation, search

This page is a part of the Linux and CS Systems - Getting Started. This page assumes you have your computer setup to connect to the CS server, or have the appropriate software installed on your computer to run commands. Go back to the Linux and CS Systems Bootcamp main page if you don't have our system setup yet.

Getting Around

To "get around" in the terminal, use the following keys.

  • enter - a command is only executed when you press enter.
  • up and down arrows - lets you run a previously typed command again.
  • tab - if you are typing a filename, you can press tab to let the terminal auto-complete some part of it. This also works for command names (e.g., type mkdi and then tab).

The following are shortcuts for directories.

  • . - current directory
  • .. - directory one level up from where you are currently
  • ~ - your home directory
  • / - the top of the entire file system

The following are special notes about directory or file names.

  • "" - if you have a file name with spaces in it, then you put the file name within "". So you could do mkdir "Some Directory"
  • * - called a wildcard, used to specify all file names that match some pattern. To list all files that end in ".pdf" you could type ls *.pdf.

Sample Session

Here is an example session from running on the CS server using all of these commands. Note that the part "cs20200@cs:~> " is a prompt that is printed by the terminal, and the part after this is what was typed by the user. So for the first command, the user typed the command uptime and then pressed enter. The system then printed some information on the next line, and then printed the prompt "cs20200@cs:~> " again to indicate it is ready for the next command. The prompt displays "cs20200" because that is the user that was logged in running these commands. If your username was "cs15115" then your prompt would be something like "cs15115@cs:~>".

You should login to one of the CS systems, open up the terminal, and try out these commands as well. If you get an error, check that you are typing the commands exactly as they are given here.
[video demo]