Cat –n test1
It shows with no of lines including spaces
Cat –b test1
It just consider the data as line
Stat test1
It will show file size, file name and last modify date
File test1
It shows file format
Ps –ef
Ps –l
Ps –eFH
$ grep -v t file1
one
four
five
$
If
you need to find the line numbers where the matching patterns are found, use
the -n parameter:
$ grep -n t file1
2:two
3:three
$
If
you just need to see a count of how many lines contain the matching pattern,
use the -c parameter:
$ grep -c t file1
2
$
If
you need to specify more than one matching pattern, use the -e parameter to specify each
individual
pattern:
$ grep -e t -e f
file1
two
three
four
five
$
$ grep [tf] file1
two
three
four
five
compress
$ ls -l myprog
-rwxrwxr-x 1 rich
rich 4882 2007-09-13 11:29 myprog
$ bzip2 myprog
$ ls -l my*
-rwxrwxr-x 1 rich rich 2378 2007-09-13
11:29 myprog.bz2
As
you can see, the uncompressed file is back to the original file size. Once you
compress a text
file,
you can’t use the standard cat, more, or less commands
to view the data. Instead, you
need
to use the bzcat command:
$ bzcat test.bz2
This is a test text
file.
The quick brown fox
jumps over the lazy dog.
This is the end of the test text file
To
uncompress the file, just use the bunzip2 command:
$ bunzip2 myprog.bz2
$ ls -l myprog
-rwxrwxr-x 1 rich rich 4882 2007-09-13
11:29 myprog
$ gzip myprog
$ ls -l my*
-rwxrw
$ zip -r testzip test
adding: test/ (stored
0%)
adding: test/test1/ (stored 0%)
tar -cvf test.tar test/ test2/
setting local env var
$ test=testing
$ echo $test
Testing
$ test=testing a long
string
-bash: a: command not
found
$ test=’testing a
long string’
$ echo $test
testing a long string
$
$ bash
$ test=testing
$ echo $test
testing
$ exit
exit
$ echo $test
$
The test
environment
Global env var
This
is done by using the export command:
$ echo $test
testing a long string
$ export test
$ bash
$ echo $test
testing a
Remove env var
$ echo $test
testing
$ unset test
$ echo $test
No comments:
Post a Comment