Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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 v cat > filename

  • View a file v cat /etc/passwd v more /etc/passwd v more filename

  • Copy file1 ,making file2 v cp file1 file2

  • Rename file1 as file2 v mv file1 file2

  • Delete file1 as file2 vrm file

//Deletefile // Double-check first

v rm -i file Counts the lines, words, characters in file

vwc file Search file for a string

v grep Andrw /etc/passwd v grep printf( hobby.c v grep ^loca /usr/dict/words

// List lines containing Andrw in /etc/passwd

//Lines containing printf( in hobby.c

//Lines starting with loca in /usr/dict/words

1

  • Output can be redirected to a file with> v ls > dir.txt v cal 1997 > year1997

  • Output can be appended to a file with >> v cal 1997 > years v cal 1998 >> years

  • Concatenate two files v cat f1 f2 > fs

  • Input redirection (less common) uses < v wc < years

  • Combine input and output redirection v wc < years > year-counts

  1. Do screenshot of each steps you have completed.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

c. What were you expected to do when you grew up?

Answered: 1 week ago