Project

General

Profile

Useful shell commands » History » Version 26

Amber Herold, 03/27/2013 09:38 AM

1 1 Amber Herold
h1. Useful shell commands
2
3 9 Amber Herold
Link to "top 10 cheat sheets":http://www.cyberciti.biz/tips/linux-unix-commands-cheat-sheets.html.
4
5 7 Amber Herold
6
h3. make a folder writable
7
8
<pre> chmod -R g+rw eman_recon14</pre>
9
10 20 Amber Herold
h3. change the owner of a folder and its contents
11
12
<pre>
13
chown -R <usename> <folder>
14
</pre>
15
16 1 Amber Herold
h3. check the status of a job
17
18
# ssh to the processing server
19
# <pre>qstat -au YOUR_USER_NAME</pre>
20
# will list your jobs
21
22 7 Amber Herold
h3. check which nodes are currently being used on processing machine
23 1 Amber Herold
24 7 Amber Herold
<pre>
25
qstat -an
26
</pre>
27 1 Amber Herold
28 10 Amber Herold
h3. check the status of each node on the cluster
29
30 18 Amber Herold
# spew a bunch of info about each of the nodes including status:
31
<pre>
32
pbsnodes
33
</pre>
34
# For a graphic version use the command ( remember to use -X with
35
ssh to display it back to your computer):
36
<pre>
37
xpbsmon
38
</pre>
39 1 Amber Herold
40
h3. kill a process
41
42
# Log into the machine it is running on
43
<pre>ssh fly</pre>
44
# Look for processes with your user name
45
<pre>ps -ef |grep [your_username]</pre>
46
# Kill the process using the number in the first column after your username
47
<pre>kill [process id]</pre>
48
# If the process was a copy, remove the destination folder
49
<pre>rm [destination folder]</pre>
50
# list system stats
51
<pre>top</pre>
52 2 Amber Herold
53 5 Amber Herold
h3. submit a job to a job manager
54
55
<pre>
56
qsub <jobfilename>
57
</pre>
58
59 4 Amber Herold
h3. Kill a job running through the job manager
60 2 Amber Herold
61 3 Amber Herold
* use *qdel* <job number>
62 5 Amber Herold
63
h3. Start an interactive session on a node
64
65
<pre>
66
qsub -I
67
</pre>
68
69 17 Amber Herold
* you can type in job file contents line by line and see results.
70 1 Amber Herold
71 6 Amber Herold
h3. Check how much space is available on a data drive
72
73 8 Amber Herold
* cd to the drive (cd /ami/data00) and type:
74 1 Amber Herold
<pre>
75
df -h .
76
</pre>
77 7 Amber Herold
78
* to show disc usage status of all mounted systems:
79
<pre>
80
df -h
81
</pre> 
82 6 Amber Herold
83 11 Amber Herold
h3. see how large the files are in a directory
84
85
<pre>
86
du
87 1 Amber Herold
</pre>
88 17 Amber Herold
89
* Or for a more human readable command:
90
91 12 Amber Herold
<pre>
92
du -sch *
93
</pre>
94 11 Amber Herold
95 6 Amber Herold
h3. See what groups a user belongs to
96
97
<pre>
98
id <username>
99
</pre>
100 16 Amber Herold
101 22 Amber Herold
* *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.
102
103 26 Amber Herold
h3. Find user name from UID
104
105
<pre>
106
awk -v val=UID -F ":" '$3==val{print $1}' /etc/passwd
107
</pre>
108
109 21 Amber Herold
h3. Find the version of CentOS installed
110
111
<pre>
112
# cat /etc/*release*
113
</pre>
114 1 Amber Herold
115 23 Amber Herold
h3. Fix a _Stale NFS file handle._ error
116 22 Amber Herold
117
Do a lazy unmount followed by mount.
118
119
<pre>
120
umount -l <drive>
121
mount <drive>
122
</pre>
123 24 Amber Herold
124 25 Amber Herold
OR
125
126
On the file server:
127
<pre>
128
exportfs -f
129
</pre>
130
131 24 Amber Herold
h3. See what modules are available on a cluster
132
133
On Garibaldi at least:
134
<pre>
135
module avai
136
</pre>
137
displays a list of all the installed modules that can be added to your .cshrc file.