This is an old revision of the document!
Table of Contents
Getting Started with Linux
Using the Linux Shell
From the Linux prompt you can move your files around, check on your jobs, manage your disk space, and run programs. Below are some brief introductions to basic commands. For more info, this is a reasonably good tutorial. Note that most of the the Linux shell functionality is the same as a UNIX shell (the shell that you get when you open a Mac terminal). There are many resources online to help you learn how to use the Unix shell.
ls
The ls
command lists the files in a particular directory. To use it, type ls
at the prompt and press enter:
[username@econ1 ~ ]$ ls
You can use wildcards with ls
to list only files matching a particular expression. That is, the command
[username@econ1 ~ ]$ ls *.do
will list only your .do files in the current directory.
mv
The mv
command allows you to move files or directories from one directory to another
mv [file] [directory]
mkdir
The mkdir
command creates a new directory. It's usage is
mkdir [new directory name]
rm
The rm
command deletes the files specified after the command. The following code would delete all .do files in your current directory.
rm *.do
You can delete an entire non-empty directory with:
rm -r [directory]
rmdir
The command rmdir
deletes an empty directory:
rmdir [directory to delete]
man pages
To get help about a command, you can view it's “man page,” which describes how the command works. It describes the syntax and usage for the command. To view a man page, type:
man [command]
You can move up and down the man page with the arrows. Typing q quits.
Changing your Password
You can change your password by using the command:
passwd
at the command prompt. You will be prompted for your current password. Type this password and press enter. Note that when you type your password, no characters will appear. This is for security purposes and is normal.
Next you will be prompted to enter your new password twice. Do so, and your password will be successfully changed!
Alias
Sometimes you use a certain command so many times that you just can't type it anymore. That's where the aliases come helpful. Just as the name suggests, you can tell the cluster to use some new (shorter) command in place of the one you use often. As an example, every time I log in to the cluster, I go to cd ~/files/pics/cute_pics/cats
and I want to change it to just cats
.
First, I start editing my bash profile with any text editor. For example
nano ~./bash_profile
Then I go to the space below # User specific environment and startup programs
and type
alias cats="cd ~/files/pics/cute_pics/cats"
I save the file and refresh the changes by typing
source ~/.bash_profile
Now typing
cats
sends me directly to the folder I need.