Linux Concepts: Part 3
Tr:- translates from one character set to another, deletes character or eliminate repetition of certain characters.
Cut:- extract specify the portion of each input line.
Paste:- together corresponding line from several files into one long line or concatenates all the lines of a single file into one long line.
Fold:- long lines into sequence of shorter ones.
Expand:- and unexpand transform tabs to spaces and spaces to tabs.
Unique:- eliminate or report adjacent repeated lines in its input.
Comm:- select or reject lines that are common to two sorted files.
The head programme express the beginning of a file or several files.
The tail programme except the large part of the file.
The join command performs the data base style join on to input files.
The csplit utility splits the file into protion according to specific criteria and copy each portion other than the tail into a sub file.
The touch command touches the file updating its excess and modification time. If the file does not exists it is created unless it specifies otherwise.
The wc command counts the number of characters words or line in a file or a set of files.
The compress programme compresses a set of files using the Lempel-Ziv algorithm. The uncompress and zcat program undo the compression when compress comprises a file if it renames the file.Z.
The gzip programme comprises file using Lempel-Ziv. The corresponding expansion program is becoming gunzip
The tar program is primarily intended to read and write archives store on a magnetic space, although the archives that it works with and also with stored other media or left as an ordinary file To list all the files in that archive, type:-
tar tf /dev/rst0
To extarxt the files from imelda's directory, shoes withijn that archive and restotre them to their original places,type
tar xvf /dev/rst0 /home/imelda/shoes
To extract the contents of the distribution file wizbang.tar.gz in such a way that the distribution becomes a sub-directory of ~/local, type tar -xvz -C ~/local -f wizbang.tar.gz
If you are using GNU tar, An alternative, not depending on the GNU options is :gunzip -c wizbang.tar.gz | (cd ~/local; tar -xvf -)
You can schedule jobs to be run periodically by inserting request into your crontab entry, kept in a crontab file. The principal purpose of job scheduling with crontab entries is to run administrative jobs such as system made, but POSIX provides the same facility from individual users.Most systems keep each user's crontab entry in a separate file, named for the user. You must use the crontab utility to operate on crontab entry; you cannot operate on it directly.
The crontab file for user user is located at /var/spool/cron/crontabs/user or at a similar location within /usr/spool
A nice command enables you to execute another commmand at lower priority. It is called as nice because ;lowering your execution priority is a way of being nice to other users.
The sleep command sleeps (i.e., does nothing) for a specified number of seconds. After that time has elapsed, it terminates.
The passwd command enables you to change your password after you have been registered as a user in your system.
The id command produces user and group ids on standard output
The expr command evaluates an expression which may include arithmetic operations, comparisons, logical operations and pattern matches.
The form of the expr command line is:
expr expr
where expr is the expression to be evaluated. The value of expressions which may be either a integer or a string sent to standard output. Under most circumstances, you can replace the use of str by an arithmetic expression recognised by the shell.
Conventions for writing the expressions:-
The expression consistes a sequence of words, each of which is either a value, an operator, or a parenthesis.
Words must be separated by whitespace. A number of the operators contain characters such as ">" that meaningful to various shells; these charcters must be quoted. Parenthesis, which usually mmust be quoted, have their usual mathematical meaning.
For example, If you type:-
expr \( 3 + 4 \) \* 8
You will get the output 56.
You must also escape null strings and string containing blanks.
It supports the following types of operators:
- Arithmetic operators ( + - * /)
- Comparison operators (< > <= >= !=)
- Logical operators (expr1 | expr2) (expr1 & expr2)
EXPR is particularly useful in Bourne-Shell scripts way of doing internal arithmmetic. For instance, the following line in a Bourne-shell script sets the variable w to the sum of the variables w1 and w2:-
w = 'expr $w1 + $w2'
Comments
Post a Comment