0% found this document useful (0 votes)
38 views

Assignment - 1 (Unix)

The document provides instructions on various Linux commands. It discusses how to create a directory tree structure and navigate between directories. It also covers commands for copying files recursively, checking file permissions, viewing disk usage, setting file timestamps, creating files, finding files, grepping/sedding/sorting text, and using the sleep command to run jobs in the background.

Uploaded by

concord0008
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

Assignment - 1 (Unix)

The document provides instructions on various Linux commands. It discusses how to create a directory tree structure and navigate between directories. It also covers commands for copying files recursively, checking file permissions, viewing disk usage, setting file timestamps, creating files, finding files, grepping/sedding/sorting text, and using the sleep command to run jobs in the background.

Uploaded by

concord0008
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment – 1

1. Tree structure
cd ~
mkdir training
cd ~/training
mkdir level1
cd ~/training
mkdir level2
cd ~/training
mkdir cep
cd ~/training/level1
mkdir sdp
cd ~/training/level1
mkdir re
cd ~/training/level1
mkdir se
To reach the home directory from the subdirectory ‘se’ in one step
cd or cd ~

To navigate to the subdirectory ‘sdp’ in one step


cd ~/training/level1/sdp

2. cp -r /dir1 /dir2

cp copy command
-r recursive, copies all the sub-directories.

3. A person must have write permission to send a message and read permission to read a
message.So through ls - l command you can check your permissions,if you have write
permissions then you can send the message.

4. In the home directory type 


du -b –s
-b display the occupied space in bytes.
-s display occupied space including all sub directories

5. date +%T

6. date “+%Y-%m-%d”
or
date +%F

7. touch chapa chapb chapc chapd chape chapA chapB chapC chapD chapE chap01 chap02
chap03 chap04 chap05 chap11 chap12 chap13 chap14 chap15
8. find . -name "*[a-z]"

9. find . -name "*[A-Z]"

10. find . -name "*0?"

11. find . -name "*[a-z]" -not \( -name "*a" -o -name "*c" \)

12. grep -c programmer personnel

-c display the number of matched lines.

13. sed -n /programmer/p personnel

14. sed 's/programmer/software professional/g' personnel

15. sleep command  suspands  program execution for a specified period of time. The sleep
instruction suspends the calling process for at least the specified number of seconds (the
default), minutes, hours or days.
sleep number [suffix]
Where number may be any integer or floating point number, and suffix is an optional. suffix to
indicate the time period.
for eg -
s(seconds)
m(minutes)
h(hours)
d(days)
Examples
Sleep 5
Causes the current terminal session to wait 5 seconds. The default unit is seconds.
Sleep 5h
Causes the current terminal session to wait 5 hours.
also,sleep 5h30m and sleep 5h 30m are illegal since sleep takes only one value and unit as
argument. However, sleep 5.5h is allowed.

To start five jobs in the background, each one sleeping for 10 minutes-

1. sleep 10m ; date &


2. sleep 10m ; cal &
3. sleep 10m ; ls &
4. sleep 10m ; man sleep &
5. sleep 10m ; mplayer hello.mp3 &

16. ps –e or ps –A

You might also like