Question

Objective: The objective of this lab is to work with files of UNIX file system. Procedure:...

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.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

root@tryit-renewing:-# touch file1 root@tryit-renewing:-.# 1s file file1 root@tryit-renewing:-# cat-file1 hello everyone... fwww-data:x:33:33:www-data:/var/www:/usr/sbin/nologin ackup:x:34:34:backup:/var/backups:/usr/sbin/nologin list:x:38:38:Mailingroot@tryit-renewing:- # touch file2 root@tryit-renewing:-.# cp filel file2 root@tryit-renewing:-# cat file2 hello everyone...

Add a comment
Know the answer?
Add Answer to:
Objective: The objective of this lab is to work with files of UNIX file system. Procedure:...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using Ubuntu OS... help is greatly needed! Thank you. Create an alias called "home" that does...

    Using Ubuntu OS... help is greatly needed! Thank you. Create an alias called "home" that does two things... returns you to your home directory, then does a long listing of all files found there Create a file called "Output.txt" that contains the output of the "ls /etc" command Using "cat", create a file called "poem.txt" where you enter at least one line of text ("Mary had a little lamb" will do...) Using "cat", pipe the contents of poem.txt into the...

  • As you know, Is lists all the files in a directory and wc counts words, characters,...

    As you know, Is lists all the files in a directory and wc counts words, characters, and lines. Which of the following operations counts the amount of files (and directories)? Select one: O b. Is wc -w c. Is 1I cat | wc -w In the picture an output of the command Is -I is shown. Which of the following statements is true? druxruxrux. 3 kuivi users 80 May 16 2001 dir ru-ru-rw-. 1 kuivi users 1696 Oct 19 1995...

  • Objective: Practice common UNIX commands. Procedure: The following list of Unix commands are given for self-learning....

    Objective: Practice common UNIX commands. Procedure: The following list of Unix commands are given for self-learning. Use 'whatis' or 'man' command to find out about each command. Your document should include the description or screen shots of the output from each of the command. Commands: df du gzip file history wget Changing access rights: chmod u+x Dir1.0            adds execute permission for the owner chmod go-w file1              removes write permission for the group and others chmod ugo=rw testfile     sets...

  • A filename con comprise multiple embedded dots (e.g., a.b.c.d.e). True False A device file is not...

    A filename con comprise multiple embedded dots (e.g., a.b.c.d.e). True False A device file is not really a stream of characters and doesn't contain anything at all. True False Relative pathnames begin with the root directory. True False Running the ls -a command uniquely identifies directories and binary executables. True False What is the result of running mkdir -p share/man/cat1 from the command line? a. It creates the directory share. b. It creates the directory share/man. c. It creates the...

  • UNIX File Permission help, please answer the questions in the green boxes. Thank you Lab 03...

    UNIX File Permission help, please answer the questions in the green boxes. Thank you Lab 03 File Permissions In this lab we will: learn about file permissions learn to create symbolic links and hard links Utilities that will be utilized in this Lab: us, cd, less, cat touch, chmod id umask, mkdir, In, echo and redirection Users and Groups Linux supports several methods of controlling access to files an directories. In this lab we are going to learn the traditional...

  • Using Unix processes Submit a README file that lists the files you have submitted along with...

    Using Unix processes Submit a README file that lists the files you have submitted along with a one sentence explanation. Call it Prj1README. MakeCopy.c : Write a C program that makes a new copy of an existing file using system calls for file manipulation. The names of the two files and copy block sizes are to be specified as command line arguments. Open the source file in read only mode and destination file in read/write mode. ForkCopy.c : Write a...

  • UNIX is all about manipulating files and input/output streams fluidly, so it is important to get a strong grasp of how...

    UNIX is all about manipulating files and input/output streams fluidly, so it is important to get a strong grasp of how this fundamentally works at the system call level to understand higher-level system programming concepts. Every program automatically has three file descriptors opened by the shell standard input standard output standard error 1 2 One can use read and write other open file. Normally, standard input and output on the terminal are line-buffered, so, for example, the specified number of...

  • Most system administrators would like to know the utilization of their systems by their users. On...

    Most system administrators would like to know the utilization of their systems by their users. On a Linux system, each user's login records are normally stored in the binary file /var/log/wtmp. The login records in this binary file can not be viewed or edited directly using normal Linux text commands like 'less', 'cat', etc. The 'last' command is often used to display the login records stored in this file in a human readable form. Please check the man page of...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT