-
December 13th, 2001, 12:00 AM
#1
*nix Commands: 102 - Addenum
I get the feeling I'm gonna add these addenums all the time to these *nix commands tutorials. Some more commands that are helpful with files:
pg filename: see a file one screenful at a time. Can also use: more filename. Difference between the two is that more shows you what percentage you have gone through in the document thus far.
cat filename: show all the contents of a file. Remember, you NEVER cat a directory as you will get garbage. You can paginate this command by piping it to a more command e.g., cat filename | more.
head -# filename: displays a certain number of lines from the top of a file. By default, without options, it shows the top 10 lines head filename. If you wanted to see the top 15 lines you'd type head -15 filename.
tail -# filename: displays a certain number of lines from the bottom of a file. By default, without options, it shows the bottom 10 lines tail filename. If you wanted to see the bottom 23 lines you'd type head -23 filename.
But what if you wanted to see line 14 and only line 14? Well that's where a friendly little critter called a pipe | comes in handy. A pipe is merely a filter. It takes the output of one command and makes it the input of another. So for this example I could do head -14 filename | tail -1.
chown user:group: change the ownership of a file or directory.
Out of these commands, the only one that has an equivant are the cat and more commands. cat is similar to the type command and more can be used in a fashion with a pipe and type e.g, type filename | more.
-
December 13th, 2001, 05:26 AM
#2
Member
thanks for the tutorial! very helpful.
-
December 13th, 2001, 01:34 PM
#3
interested in a UNIX bash tutorial?
Dear Santa, I liked the mp3 player I got but next christmas I want a SA-7 surface to air missile
-
December 13th, 2001, 02:03 PM
#4
Junior Member
more command ???
Perhaps you can had some other useful command...
for example use < b > less < /b > instead of more so you can view the file in both direction ...
to view some HOWTO nicely (when they appeared with line like ^H ...) do this : cat howtofilename | less
so you can go down and up in the file ...
I know more command but time is money like they say and I need to make some work for tommorow :{
Bye.
PS: sorry for the tags, I need to learn more about this site
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|