Basic UNIX commands

Listing
machine% ls -l ~plewis/2021/ETM-*
The command 'ls -l' provides a 'long' listing of whatever you specify afterwards. In this case, '~plewis' refers to 'the home of plewis' (here otherwise known as /home/plewis). 2021 is a subdirectory of my plewis' home directory, and there are a bunch of files that start 'ETM-' - the * is a wildcard (meaning ETM_ followed by anything).
The command should result in (something like):

-rw-r--r-- 1 plewis ps 196608 Nov 24 2006 /home/plewis/2021/ETM-1108subset
-rw-r--r-- 1 plewis ps 938 Nov 24 2006 /home/plewis/2021/ETM-1108subset.hdr
-rw-r--r-- 1 plewis ps 34200000 Sep 28 2006 /home/plewis/2021/ETM-190600
-rw-r--r-- 1 plewis ps 546 Sep 28 2006 /home/plewis/2021/ETM-190600.HDR
-rw-r--r-- 1 plewis ps 1391 Sep 28 2006 /home/plewis/2021/ETM-190600.sta


The first 'field' (-rw-r--r--) tells you about file permissions. It is grouped into 3 categories. -rw-r--r-- means that the owner (plewis) has read-and-write permission (rw) and that others have only read permission (r-).
The third field tells you the file owner.
The fifth field tells you the file size in bytes.
Thats all you really need to know right now.


As an exercise, see what files (and sub-directories ...) you have in your home directory, e.g.

machine% ls -l ~

This should include something like:

lrwxrwxrwx 1 plewis ps 23 Nov 6 2002 Data -> /data/rsu_raid_0/plewis/

Note that the 'permissions' field is different here (lrwxrwxrwx). This is telling us that (i) this is not a 'real' file or directory, but a 'symbolic link' to somewhere else (/data/rsu_raid_0/plewis/) in this case. So when we refer to ~plewis/Data, we are actually referring to /data/rsu_raid_0/plewis/. ; (ii) everyone has access permission to that directory (rwx)

change directory
Let's change the directory we are in now (by default, you will start in your home directory). Suppose we want to go to the directory 'Data'.If we are in the home directory, we could type:
machine% cd Data

If we are elsewhere on the system, we would have to give the full pathname to get there:
machine% cd ~/Data

make a new directory
machine% mkdir practical1
change directory again (relative to where you are ...)
 
machine% cd practical1
copy a file into the current directory ('.' == 'dot' == current directory)
 
machine% cp ~plewis/2021/ETM-* .
Note that the * symbol is a wildcard, so '~plewis/2021/ETM-*' is all files that start with ~plewis/2021/ETM-. The . ('dot')  means the current directory. ~ ('tilde' or 'twiddle')  refers to the home directory of a user, so ~plewis refers to the home directory of plewis.

You should check to see what files have been copied over, e.g.:
machine% ls -l ~/Data/practical1


Some other useful commands: