In: Computer Science
Basic Unix Commands
Objective:
The objective of this lab is to work with files of UNIX file
system.
Procedure:
1. OpenyourUnixshellandtrythesecommands:
Ø Create a new file and add some text in it vcat > filename
Ø View a file
vcat /etc/passwd vmore /etc/passwd vmore filename
Ø Copy file, making file2 vcp file1 file2
Ø Move/rename file1 as file2 vmv file1 file2
Ø Delete file1 as file2 vrm file
//Deletefile //Double-checkfirst
vrm -i file
Ø Counts the lines, words, characters in file
vwc file
Ø Search file for a string
v Grep lubuntu /etc/passwd v grep 'else' /etc/profile
v grep ^united ~/myFile
// List lines containing ‘lubuntu’ in /etc/passwd
//Lines containing ‘else‘ in /etc/profile
//Lines starting with ‘united’ in ~/myFile
1
Ø Output can be redirected to a file with’>’ vls >
dir.txt
vcal 1997 > year1997
Ø Output can be appended to a file with ’>>’ vcal 1997
> years
vcal 1998 >> years
Ø Concatenate two files vcat f1 f2 > fs
Ø Input redirection (less common) uses ‘<‘ vwc < years
Ø Combine input and output redirection vwc < years > year-counts
*Do screenshot of each steps you have completed* ((using lubuntu))
if
you have any doubt then please ask me without any hesitation in the
comment section below , if you like my answer then please thumbs up
for the answer , before giving thumbs down please discuss the
question it may possible that we may understand the question
different way and we can edit and change the answers if you argue,
thanks :)