List
contents of a file |
cat
file |
cat file1
file2 |
cat file1
> file2 |
Change
File modes (permissions) |
chmod
ugo[+-=]rwx file |
chmod u+rw
file1 file2 |
chmod go-x
file2 |
Change
File Owner |
chown user
file |
chown molloyd
file1 |
Change
File Group |
chgrp group
file |
chgrp staff
file1 |
Copy
File |
cp
file dir |
cp file1 /tmp |
cp file1
file3 (copy file to new) |
Compare a
File |
diff file
file |
diff file1
file2 |
Find
a File |
find
path condition |
find . -name
file1 -print |
find
/tmp -user molloyd -print |
-user
-size -atime -exec |
find . -name
core -exec rm{}\; |
Search
a File |
grep
-vin pattern file |
grep -n
something file1 |
grep
-vi someword file2 |
-v
non-matching -i no-case -n line numbers |
grep Derek
file2 |
Link File
(symbolic) |
ln original
newname |
ln file1
../tmp/something |
Move a
File |
mv sourcefile
destfile |
mv myfile
/tmp |
To
terminal page |
more file |
more file1 |
Delete a
file |
rm file |
rm * |
View
end of a file |
tail
file |
tail file1 |
tail -f file2
(updates) |
Sort
a file |
sort
[+n] [-n] file |
sort file1 |
sort +1 file2 |
Edit
a file |
vi
file |
vi file2 |
save edits
use: 'esc' ':' 'w' 'q' |
Wordcount |
wc file |
wc file2 |
Change
Directory |
cd dir |
cd
/users/staff/molloyd |
List
Directory |
ls
dir |
ls -l /tmp |
ls |
Make
Directory |
mkdir newdir |
mkdir temp |
Remove a
directory |
rmdir olddir |
rmdir temp |
Stop
a process |
kill
[-signal] pid |
kill 23233 |
kill -9 43434
(force a kill) |
Change
Password |
passwd |
passwd |
List
Processes |
ps |
ps -Af|grep
molloyd |
List Date |
date |
date |
Disk Space
Free |
df |
df (df -k) |
Disk Usage |
du |
du
/users/staff/molloyd |
List
arguments |
echo arguments |
echo $PATH |
List
environment |
env |
env |
Where am
I? |
pwd |
pwd |
Who Logged
on |
who (finger) |
who |