Professional Documents
Culture Documents
Learnings 2
Hello world!
press CTRL+D to save file
c. To display contents of file
i. $ cat foo.txt
d. To append contents to existing foo.txt
i. $ cat >> foo.txt
e. To concatenate files do.txt and so.txt and redirect output to foo.txt
i. $ cat do.txt so.txt > foo.txt
f. For the input .. instead of using the standard input (keyboard)
i. $ cat < foo.txt
10) cp
a. to copy contents of file do.txt to file foo.txt- $cp do.txt foo.txt
b. To copy multiple files - $cp chap01.txt chap02.txt chap03.txt progs
11) mv: In Unix environment rename and moving a file are the same thing
a. Rename file- $mv deepali.txt nayak.txt
b. To move file deepali.txt to new directory nayak- $mv deepali.txt nayak
c. To move file deepali.txt one directory back- $mv deepali.txt ../
12) rm
a. $rm deepali.txt
13) $clear
14) date
a. Current date and timestamp of the server- $date
b. Set the date to a date and time shown- $ date -s "20/07/2013 12:48:00"
c. Change format of current date and timestamp- $ date '+DATE: %m/%d/%y
%nTIME:%H:%M:%S'
15) cal
a. To obtain calendar for this current month- $cal
b. To obtain calendar for specific month and year- $cal mm yyyy
16) history
a. To see last 500 commands used by me- $history
17) man
a. To list info on mkdir command- $man mkdir
b. To search commands matching keyword provided- $man k irc
Create the following directory structure and be sure your current working directory is
MYDIR when you try the following.
MYDIR is the root directory
COLORS
BASIC
red
blue
green
BLENDED
yellow
orange
pink
SHAPES
circles
square
cube
ANIMALS
MAMALS
platypus
bat
dog
REPTILES
snakes
crocodile
lizard
3. Copy back the file red from BLENDED directory to BASIC directory using relative
path
5. Move the file dog from MAMMALS to SHAPE using FULL path
6. Move back the file dog to its original place using relative path