Difference between revisions of "Centos File System Commands"

From rbachwiki
Jump to navigation Jump to search
Line 20: Line 20:
'''tail command can be used to display the end of text files. By default, the tail command displays the final 10 lines of a file, but it can also take a numeric option specifying the number of lines to dis- play on the terminal screen'''
'''tail command can be used to display the end of text files. By default, the tail command displays the final 10 lines of a file, but it can also take a numeric option specifying the number of lines to dis- play on the terminal screen'''
  tail -3
  tail -3
'''The more command gets its name from the pg command once used on UNIX systems. The pg command displayed a text file page by page on the terminal screen, starting at the begin- ning of the file; pressing the spacebar or Enter key displays the next page, and so on.'''
more file.txt
'''the less command is named for doing more than the more command (remember that “less is more,” more or less). Like the more command, the less command can browse the contents of a text file page by page by pressing the spacebar and line by line by pressing the Enter key; however, you can also use the cursor keys on the keyboard to scroll up and down the contents of the file.'''

Revision as of 20:46, 27 January 2019

File Command displays type of file

file me.text
#output
ASCII text

Wildcard Metacharacters

* Matches 0 or more characters in a filename
? Matches 1 character in a filename
[aegh]  Matches 1 character in a filename—provided this character is either an a, e, g, or h
[a-e]  Matches 1 character in a filename—provided this character is either an a, b, c, d, or e
[!a-e] Matches 1 character in a filename—provided this character is NOT an a, b, c, d, or e

Viewing Text Files

cat -n file.txt
# will display the file with line numbers
tac file.text
#will display the file in reverse

The head command displays the first 10 lines (including blank lines) of a text file to the terminal screen but can also take a numeric option specifying a dif- ferent number of lines to display.

head -3

tail command can be used to display the end of text files. By default, the tail command displays the final 10 lines of a file, but it can also take a numeric option specifying the number of lines to dis- play on the terminal screen

tail -3

The more command gets its name from the pg command once used on UNIX systems. The pg command displayed a text file page by page on the terminal screen, starting at the begin- ning of the file; pressing the spacebar or Enter key displays the next page, and so on.

more file.txt

the less command is named for doing more than the more command (remember that “less is more,” more or less). Like the more command, the less command can browse the contents of a text file page by page by pressing the spacebar and line by line by pressing the Enter key; however, you can also use the cursor keys on the keyboard to scroll up and down the contents of the file.