Here are some useful Unix basic commands that will help you navigate Ragnar.

If you have any idea, tips, comments or corrections for this page don’t hesitate on sending me an email or stopping by the lab.


Find if your process is running

Probably the command that you will use most is

top

This command allows you to check whether your process is running. It also shows CPU and memory usage

Stopping processes

kill

Moving around the file system

To list the files in the current directory:

ls

To find out the “present working directory”, or current directory.

pwd

Change current directory to your HOME directory

cd

Change current directory to /home/username/Scripts

cd /home/username/Scripts

To go to the parent directory of the current directory

cd ...

Copying Files

to copy the file filename from your home computer to Ragnar, you would use:

scp filename netid@ragnar.econ.illinois.edu:/home/netid

To copy a file (at home) from Ragnar to your home computer, the process is very similar: you use

scp netid@ragnar.econ.illinois.edu:~/exampledirectory/filename .

The period on the end is important because it tells the computer to put filename in the working directory that you are currently in at home. It can also be a path on your computer.

Check the size of directory/files.

Disk space usage can be checked by entering the following command:

du -sh ~

for specific files you can use:

du -sh tipforunix.txt

The flags: * -s report only total size of directory/file * -h gives the size of file in terms of k(M) bytes

Find a file

An example, with the most useful switches:

find /home/srmntbr2 -type f -name filename

where filename can have wild card characters if you don’t remember the whole name. Look at the man page for find to see other switches. Another cool trick is this: if you are looking for a file but only remember the contents, say words, then you can pipe the answer from find to grep:

find -type f | xargs grep <words> 

The locate command also works.

Accessing the manual

To find out all the options and things you can do with each command you can access the Man Pages. The command for that is:

man

For example:

man scp

will lead to the manual page about scp.