Académique Documents
Professionnel Documents
Culture Documents
examples ls hello
lists all the files with hello.. if that is a directory then lists all the files
within the directory
ls hel*
lists all the files starting with hel
ls hel? lists all the files starting with hel and one character ater that
lists files in other directory ls /etc
ls -a- lists all the files with a period this includes special files
ls -d lists all the directories
ls -F marks files wither it is a directory or file /-> directorys @-links * for
exe
ls -l- file owener size last modification time
ls -R lists recursively subdirectories
> redirection operation
ls | takes one output to next command
man - help command
cal -calendar
call 2008 displays the list
call month <year>- specific month
cat file - display the contents of the file
cat file1 >> file2 - appends the file
cat file1 > file2 - overrites the file
cd-change directory
cd <directory name> -switch to subdirectory
cd .. to move the parent directory of the current directory
cd / to move to root directory
chmod - give permissions
chmod options permissions filename
u-> user g->group o->owner
read,write execute(x)
4- read,2-write,1 execute 0 no permission
chmod u=rwx,g=rx,o=r myfile
date-current date
df-disk usuage
who-lists the current useers
diff difference
diff file1 file2
2,2c4,2 lines 2-4 in the first lines must be changed to match lines 2-4 in secon
dfile
2a4 addion of line4 after line 2 in irst file
4d3 delete line 4 in first file to sync up with line 2
contextal p=output
diff -c file1 file2
file1.txt 2014-08-21 17:58:29.764656635 -0400
--- file2.txt 2014-08-21 17:58:50.768989841 -0400
***************
*** 1,4 ****
apples
- oranges
kiwis
carrots
--- 1,4 ---apples
kiwis
carrots
find command
locate the contents
find. -name file.txt -print
will search for file.txt in the current dir .represent curr directory
head
first line
tail
last line
mv,cp,mkdir,pwd
finger -displays informataon about system useers
touch- saves time of opening closing the file
touch cretes a new file with new time
tr - translate deelteing squeezing characters
tr <options> set1 set2
$ tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
thegeekstuff
THEGEEKSTUFF
$ tr [:lower:] [:upper:]
thegeekstuff
THEGEEKSTUFF
$ tr '{}' '()' < inputfile > outputfile
$ echo "This is for testing" | tr [:space:] '\t'
This
is
for
testing
$ echo "This is for testing" | tr -s [:space:] ' '
This is for testing
5
$ echo "the geek stuff" | tr -d 't'
he geek suff
T
cut command
cut -c4,6 file.txt
cuts 4th and 6th character of each line in the file
cut -d' ' -f2 file.txt
prints the second filed after space
rev filename revers the contents
grep search for contents in file
awk sed text processors ind text and perform operatons on it
#usage
$ grep This file.txt
Every line containing "This"