Difference between revisions of "Centos File System Commands"

From rbachwiki
Jump to navigation Jump to search
Line 11: Line 11:
[!a-e] Matches 1 character in a filename—provided this character is NOT 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
</pre>
</pre>
'''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

Revision as of 20:42, 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