File System and File Essay

Submitted By lancer94
Words: 735
Pages: 3

Nest304 Alex McMaster Sept/2013 Unix Utilities
This lab is designed to enable you to play with some utilities.
Remember your two modes of input TTY mode – using the command line similar to MSDOS on a PC, GUI based – using the whole screen. Help is available always using apropos, man or updated new GNU systems use “info”

Edit Functions (vi, vim, and gedit)
1) Create a subdirectory in your home directory and change to it using “cd”.
2) Create a file by using “touch file name”, or use “gedit file name” or gedit by itself. The
Editor will create the file upon closing and then it will prompt you to create a file name.
3) Use the edit tool to load data to the file. Example your bio.
4) Upon completion, save the file for further use.

Create Commands
5) Find all logged-in users with usernames of at least 4 characters.
Who | grep ‘^[A-Za-z0-9]{4,}’ /etc/ passwd | cut –d –f1
6) List all files in your directory in decreasing order of file size.

ls -la |sort -k 5 -n

Utilities to provide support
7) man grep
8) info grep

Utilities to obtain system information
9) which fdisk
10) whereis fdisk
11) whatis fdisk

Note your observation on these three commands
12) $finger
13) $finger (username)

Note your observation on finger commands
Utilities to manage text
14) man hier |more
15) man hier |less

Note your observation on the above two commands
More can only scroll down, while less can go up and down.
16) head –n 20 /var/log/dmesg.0
17) tail –n 20 /var/log/dmesg .0

18) Verify the tail and head command output for dmesg.0 file
The top 20 files in dmesg.0 match the head -20 commands answer, as well the tail command answer matches the last 20 in dmesg.0
19) Sort the directory according to the size of the files and directory in ascending order ls -la |sort -k 5 -n

20) Sort the directory according to the size of the files and directory in descending order ls -la |sort -k 5 -n –r

I/O connections – stdin, stdout, stderr
21) Create file with following data cat > telephone.txt ken 234567 kate 345678 susan 234569 harry 987658 tom 234568

Ctrl +D to exit
Check the file you created using cat telephone.txt

Sort the file created by user and by number sort < telephone.txt sort < telephone.txt –k 2

22) sort telephone.txt > ph.txt
23) find / -name passwd 2> err.txt

Record your observations for stdin, stdout and stderr

Pipes
24) Unamed pipes ls –l |more ls |wc –l

Named pipes
25) Create pipes pipe1 and pipe 2 using the following command and note the file type in the permission bit of both the files

mkfifo pipe1 ls –l pipe1

mkfifo pipe2 ls –l pipe2

stdout of ls –l to pipe1 ls –l > pipe1 Note that the cursor would not return to the command prompt, as thpipe1 process has not been completed

Open another terminal cat < pipe1

Now the first terminal’s pipe1…