Basic UNIX commands
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)
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:
If we are elsewhere on the system, we would have to give the full pathname to get there:
make a new directory
change directory again (relative to where you
copy a file into the current directory ('.' == 'dot' == current directory)
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:
You might also be interested in how
much disk space there is left on the disk you are on:
kbytes used avail capacity Mounted
1930184 5873616 25% /data/prague
tells us that the disk known as /data/prague has 5873616
Kbytes available, for instance. Again, . ('dot') refers to the current
To find out which directory you are in:
To delete a file:
to compress a file:
which gives (among other things)
-rw-r--r-- 1 plewis
ps 24968838 Sep 23 13:38 ETM-190600.Z
The compressed file (with a .Z extension) is 2374280
bytes (the original was 34200000, so the compression ratio is around 1.4 in
or to uncompress:
The next time you want to run the practical, just do:
where envi43 is the software we will mostly be using for these practicals.
Today, you came across the following UNIX commands:
e.g.: cd ~plewis
make a directory
e.g.: mkdir ~/Data/something
copy files (cp <from> <to>) e.g.:
cp ~plewis/logo/ucllogo.tif ~/Data
list all files in long format e.g.: ls -l
disk space free
e.g.: df ~
print working directory e.g.:
remove a file
e.g.: rm ~/Data/ucllogo.tif
e.g.: compress ~/Data/ucllogo.tif
uncompress a (.Z) file e.g.:
You also learnt
what ~, & and . mean.
Thats enough UNIX for one day! If you want to learn more UNIX or just
some more background on workstations, directories etc., have a look at
the MSc remote
sensing course notes.