answersLogoWhite

0

What is file handling utilities?

Updated: 10/3/2023
User Avatar

Wiki User

10y ago

Best Answer
UNIX File HandlingFile Specification

File specifications provide the system with the needed information to uniquely identify a file or device. To avoid problems refrain from using characters that have other meanings. It is best to use only letters, numbers, and the period.

A full pathname consists of: /users/users3/grad/homedir

where:

/ (leading)=Root of the file system when it is the first character in the path name,users=System directory one level below root in the hierarchy/ (subsequent)=Slash that delimits the directory namesusers3, grad=Further subdirectories below /usershomedir=User's home directory.

The use of wildcards makes it seldom necessary to explicitly use the complete file specification. The question mark (?) matches any single character. The asterisk (*) matches any number of characters. The [...] means to match any of the characters inside the brackets. Numbers (e.g. [5-9]) or letters (e.g. [A-z]) can be used.

Examples:1.% lpr chap[1-3ad]*

Print all files that start with chap1, chap2, chap3, chapa, or chapd2.% cat ?

Type all files that consist of a one character name

If you wish to suppress the special meanings of *, ?, etc., enclose the entire argument in single quotes (e.g. cat '?').

File Manipulation Commands

1.Typing the contents of files can be accomplished using:

% cat filename

This displays the file on standard output, and

% cat file1 file2 > file3

concatenates the first two files and places the result on the third, overwriting the current contents of file3.2.The more command can also be used for typing out files, one screenful of text at a time. Hit space to see the next page or return to see the next line. Q or q may be used to exit from more.3.Copying files may be done by typing :

% cp fromfile tofile

The cp command does not copy a file onto itself. You may also copy one or more files onto a directory by:

% cp f1 f2 ... directory

cp -i will prompt the user with the name of the file whenever the copy will cause an old file to be overwritten.

If cp -r is used and any of the source files are directories, cp copies each subtree rooted at that name; in this case the destination must be a directory.4.The move file command (which essentially renames a file) is mv.

% mv good bad

renames the file good as bad. You can also use this command to move files or directories to a different place in the directory tree.5.Deleting files may be accomplished by rm command. To remove file foo, type:

% rm foo

Once deleted the file is gone forever (if there are no links to the file). To remove a file, you must have write permission in its directory, but you do not need read or write permission on the file itself. The -i option withrm command is useful since it allows the interactive removal of a file.6.To get a directory listing of files in the default directory, type the ls command. See the online manual for a complete list of its options. For example, the -a option lists all files in the directory, including those with names beginning with (.),which otherwise are not listed; -R option lists subdirectories recursively; -l lists the mode, number of links, owner, size in bytes and time of last modification for each file ; etc..

( the mode field needs a brief explanation - it represents the protection mode of the file - it consists of 11 characters : the first character indicates the type of entry :

  • d - if the entry is a directory
  • b - if the entry is a block type special file
  • c - if the entry is a character type special file
  • l - if the entry is a symbolic link
  • s - if the entry is a socket
  • - - if the entry is a plain file
The next 9 characters are interpreted as three sets of three characters each (read, write, execute). The first set corresponds to file-access permissions for the user, the next for the group and the last for all others. The last character of the mode (normally x or -) is t if the 1000 bit of the mode is on. See the man pages on chmod for the meaning of this mode.)

Note: The rm, cp, mv commands can cause files to be deleted. There is an optional switch -i which when used with any of these commands will query you before actually carrying out the operation. You can force the rm, cp, mv commands to query you by placing the following commands in your .login or .cshrc or .aliases file :

% alias rm rm -i

% alias mv mv -i

% alias cp cp -i

7.The command grep reg-exp file(s) searches the files for a pattern specified by a limited regular expression. There are numerous optional switches such as -ifor ignoring difference in upper and lower case; -vfor printing the unmatched lines; etc.. It is safe to enclose the entire expression argument in single quotes to avoid any ambiguity with meaningful shell commands such as $,*,[,^,(,),|,\ . The rules for the expression are listed in the man page for grep. Example:

% grep -i 'Find this text' *.tex

8.To determine the existence of a particular file anywhere in the file hierarchy starting from a specified path list you may use the find command.

Example:

To find and list all files below the current directory, whose names end in .dat:

% find . -name '*.dat' -print

To find and list all files ending in .dat and containing the word homework :

% find . -name '*.dat' -exec fgrep -i homework

{} ; -print

9.Files can be compared by the diff or the cmp commands. The latter allows comparison of binary files and directories. Usage:

% cmp file1 file2

compares file1 and file2. If they differ it announces the byte and line number at which the difference occurred. For text files it is better to use diff which lists any differences.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

Their purpose is to do different things with files and directories - renaming them, deleting them, moving them to another file system, etc.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is file handling utilities?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Explain Error handling during file operations?

explain error handling during file operation?


What are the different types of File Management Utilities?

sequence file system index file system main file system sequence index file system


What is the utilities of file in Foxpro?

There is an alternative software for working with dbf files.


What debts are legally reportable on a credit file?

Everything but, medical and utilities.......


Is an operating system responsible for file compression?

No, Operating system is not resposible for file compression. It is the task of utilities that come bundled with OS or installed by you. Some well known utilities are 7-zip, WinZip, WinRar, etc.


You want a file handling c program?

yes


What does a file management utilities do?

make it possible for your OS to save, maintain, and access files


Which of the following utilities would you use to create a file system in Linux?

For linux file system creation there are many utilities.Example commands and utilities to create partitions:fdiskcfdiskcgdiskpartedGPartedFile system types:NTFSextext2ext3ext4swapfatbtrfs...All basically does the same with slight added or reduced functionality


What is a stream in the data file handling?

A Stream is a sequence of bytes.


How do you open adt file?

To open an adt file, you must use an advantage database driven application, server or utilities. .adt file=Advantage database file. Advantage database by Sybase.


Concept of file handling in DBMS?

if we need a modifying ,sreach,delete a file so we need a DBMS


What are the names of file management utilities under Mac OS operating system?

File management is handled by the software named "Finder" in OSX.