Project

General

Profile

Useful shell commands » History » Revision 26

Revision 25 (Amber Herold, 11/05/2012 12:22 PM) → Revision 26/28 (Amber Herold, 03/27/2013 09:38 AM)

h1. Useful shell commands 

 Link to "top 10 cheat sheets":http://www.cyberciti.biz/tips/linux-unix-commands-cheat-sheets.html. 


 h3. make a folder writable 

 <pre> chmod -R g+rw eman_recon14</pre> 

 h3. change the owner of a folder and its contents 

 <pre> 
 chown -R <usename> <folder> 
 </pre> 

 h3. check the status of a job 

 # ssh to the processing server 
 # <pre>qstat -au YOUR_USER_NAME</pre> 
 # will list your jobs 

 h3. check which nodes are currently being used on processing machine 

 <pre> 
 qstat -an 
 </pre> 

 h3. check the status of each node on the cluster 

 # spew a bunch of info about each of the nodes including status: 
 <pre> 
 pbsnodes 
 </pre> 
 # For a graphic version use the command ( remember to use -X with 
 ssh to display it back to your computer): 
 <pre> 
 xpbsmon 
 </pre> 

 h3. kill a process 

 # Log into the machine it is running on 
 <pre>ssh fly</pre> 
 # Look for processes with your user name 
 <pre>ps -ef |grep [your_username]</pre> 
 # Kill the process using the number in the first column after your username 
 <pre>kill [process id]</pre> 
 # If the process was a copy, remove the destination folder 
 <pre>rm [destination folder]</pre> 
 # list system stats 
 <pre>top</pre> 

 h3. submit a job to a job manager 

 <pre> 
 qsub <jobfilename> 
 </pre> 

 h3. Kill a job running through the job manager 

 * use *qdel* <job number> 

 h3. Start an interactive session on a node 

 <pre> 
 qsub -I 
 </pre> 

 * you can type in job file contents line by line and see results. 

 h3. Check how much space is available on a data drive 

 * cd to the drive (cd /ami/data00) and type: 
 <pre> 
 df -h . 
 </pre> 

 * to show disc usage status of all mounted systems: 
 <pre> 
 df -h 
 </pre>  

 h3. see how large the files are in a directory 

 <pre> 
 du 
 </pre> 

 * Or for a more human readable command: 

 <pre> 
 du -sch * 
 </pre> 

 h3. See what groups a user belongs to 

 <pre> 
 id <username> 
 </pre> 

 * *note:* the user's umask should be set to 002 in their .cshrc file if they are not using the global one to make sure AMI group members can process their data. 

 h3. Find user name from UID 

 <pre> 
 awk -v val=UID -F ":" '$3==val{print $1}' /etc/passwd 
 </pre> 

 h3. Find the version of CentOS installed 

 <pre> 
 # cat /etc/*release* 
 </pre> 

 h3. Fix a _Stale NFS file handle._ error 

 Do a lazy unmount followed by mount. 

 <pre> 
 umount -l <drive> 
 mount <drive> 
 </pre> 

 OR 

 On the file server: 
 <pre> 
 exportfs -f 
 </pre> 

 h3. See what modules are available on a cluster 

 On Garibaldi at least: 
 <pre> 
 module avai 
 </pre> 
 displays a list of all the installed modules that can be added to your .cshrc file.