UNIX help

UNIX help...


  You are here:   Home computer stuff computer help UNIX help


This page is mainly to remind myself of a few things to do with UNIX. Pick from one of the following:

basic commands using Condor managing jobs file permissions shell scripts more info



Basic commands [top]

cd<path> changes directory to path
.. changes to parent directory
~ changes to home directory
(s)cp<source path> <destination path>(secure) copies from source path to destination path
du find disk usage (in directory)
-hs find disk usage (in "human-readable" form)
-a   <path>  |sed -n '$= 'count number of files in path
find<path>  \*<string>\*find all files below path
finger<username> shows login information about username
grep<pattern>  <file> scans file for instances of patternand prints the relevant lines
-c   <pattern>  <file> counts instances of pattern in file
hostname displays name of current machine (in a cluster)
-i   <machine name> displays IP address of a machine (in a cluster)
ls lists all files and directories in current location
<path> lists files in path
-a lists all files (including "hidden" files)
-l lists files, showing file info (permissions, dates)
|   more lists files one page at a time (advanced by space)
mkdir<directory name> creates a directory directory name
mv<original path> <destination path>moves/renames file(s) from original path to destination path
pssh executes a command on all machines in a cluster
"ps -fu maman" shows all processes of user maman
w shows who is logged in on each machine (individually)
"top -n 1 -b" shows top 4 processes on each machine (individually)
<command>   <file> executes command for cluster machines listed in file (each machine on a separate line)
rm<path> removes (deletes) a file with specified path
-R   <directory name> removes (deletes) a directory and all files contained within it
rmdir<directory name> removes a directory specified by directory name (must be empty)
who lists all usernames logged into a system



Using Condor [top]

Condor is a job submission and queue management system for computer clusters. Here are a few basic commands:

condor_prio-p   <value>   <jobno> changes priority of jobno within user to value (values range from -20 to +20, with +20 being best priority)
condor_q shows the condor queue, including job status and runtime
-run shows only the running jobs, with host machine information
-submitter <username> shows the job info for a specific user
condor_rm<jobno> removes the job jobno from the queue
condor_status shows the status of the cluster, including activity and job runtime
-run shows the machines in the cluster with running jobs, including user allocation
condor_submit<command file> submits jobs described within command file to the condor queue
condor_userprio shows (active) user queue priorities
-all shows full user queue priority info (effective and real priorities, resources used...)
-setprio   <username>   <value> changes queue priority of username to value
-setfactor   <username>   <value> changes queue priority factor of username to value


Examples of some of these commands and Condor command files are here and more fully here (departmental documents).

The official Condor manual is useful for setup and extra commands.


Managing jobs [top]

kill   -<value>   <pid> kills process with pid pid with option flag value (eg. kill -9 <pid> will hard kill the job)
ps   ux finds (user-)running processes on a terminal
top shows all processes running on a machine (incl. info about memory/cpu usage, pid etc)
renice   <value>   <pid> changes priority of process with pid pid to nice value value (eg. renice -19 <pid> will set the job to priority 19)



Shell scripts [top]

A bit of information about running scripts...

at now -f <file> &larr runs an executable file from the shell prompt


Example of a simple executable file:

nice -19R--save -q< inscone> outscone.out
&uarr&uarr&uarr&uarr&uarr
set priority of jobapplicationarguments to applicationinput file (eg R commands)output file (screen output)


You can use a "master" file to e.g. run different scripts depending on specific machines (in a cluster):

#!/bin/csh
setenv HOSTNAME `hostname -s` &larr sets HOSTNAME variable to short hostname (without domain)
cd /home/maman/mydir &larr sets directory containing executable
if ($HOSTNAME == "zeppo") then
at now -f runscone1 &larr runs executable
else if ($HOSTNAME == "chico") then
at now -f runscone2
...
else
echo "Unknown host"
endif
To run the masterfile executable, do eg. ~/MASTER or ./MASTER. Make sure that the permissions for the masterfile are set properly


More info... [top]