Linux+ 103 Organized

verickle's version from 2017-11-13 19:40

Process text streams using filters

Question Answer
expandconverts tabs in a file into spaces
unexpandconverts spaces into tabs
splitdivide a file into two or more files
fmtchanges the line lengths or other such formatting issues in a text file
wcallows you to see the word count of a file
odallows you to view the contents of a file in different ways, for example in control character form or hexadecimal form
headdisplay the first 10 lines of a file
taildisplay the last 10 lines of a file
trconvert one set of characters to another
prformats files for printing
nlnumbers lines in a file for printing
sortsort the contents of a file alphabetically
cutextracts certain lines from a file
cut -coutputs only specific characters
cut -foutputs only specific fields
uniq -cprefix each listed output with the number of occurrences
uniq - iremove duplicate lines from a sorted file while ignoring differences in casing during the process


Question Answer
-bnumbers the lines in the body of the file
acan be used with the -b, -h, or -f parameters to number all the lines in the file, even the empty lines
-fnumber the file's footer
-hnumber the file's header


Question Answer
-foutputs only specific fields
-bspecify the bytes to be displayed
-coutputs only specific characters
-dchange the delimiter from the TAB designation to the DELIM designation


Question Answer
-c, --crown-marginPreserves indentation of the first two lines.
-p, --prefix=STRINGCombines only lines having STRING as prefix.
-s, --split-onlySplits long lines.
-u, --uniform-spacingUses one space between words and two spaces after sentences.
-w, --width=WIDTHProvides a maximum line width (default of 75 columns).


Question Answer
lessquickly view any file and any section of a file
-gHighlights just the current match of any searched string
-IPerforms case-insensitive searches
-MShows more detailed prompt, including file position
-NShows line numbers
-SDisables line wrap


Question Answer
morea filter for paging through text one screenful at a time
-numIt specifies an integer, which is the screen size (in lines).
-dmore will prompt the user with the message "[Press space to continue, 'q' to quit.]" and will display "[Press 'h' for instructions.]" instead of ringing the bell when an illegal key is pressed.
-lmore treats ^L as a special character, and pauses after any line that contains a form feed. The -l option prevents this behavior.
-fIt causes more to count logical, rather than screen lines (i.e., long lines are not folded).
-uIt suppresses underlining.
+/It specifies a string that will be searched for before each file is displayed.
+nummore starts file at line number num.


Question Answer
-oonly receive the part of the matching line that matches the text string
-nspecifies that line numbers should be included
-cspecifies that you want a count of the number of occurrences of the text string
-vdisplay all lines that don't match the specified pattern
-isearch for all occurrences of a word, regardless of the casing
egreptreats the specified pattern as regular expression and special characters as meta-characters by default
fgreponly processes simple strings not complex patterns
pgrepsearches through the currently running processes and returns the process IDs that match the criteria


Question Answer
-wReturns the number of words in the file
-cReturns the number of characters in the file
-lReturns the number of lines in the file


Question Answer
-iInstalls a package; system must not contain a package of the same name
-UInstalls a new package or upgrades an existing one
-F or --freshenUpgrades a package only if an earlier version already exists
-qQueries a package—finds whether a package is installed, what files it contains, and so on
-V or --verifyVerifies a package—checks that its files are present and unchanged since installation
-eUninstalls a package
-bBuilds a binary package, given source code and configuration files; moved to the rpmbuild program with RPM version 4.2
-cdisplays a list of all the configuration files in a package
-l or --listDisplays the files contained in the package
--rebuildBuilds a binary package, given a source RPM file; moved to the rpmbuild program with RPM version 4.2
--rebuilddbRebuilds the RPM database to fix errors
--dumpdisplays a dump of file information on the console and must be used with either the -l, the -c, or the -d parameters
-a or --allQueries or verifies all packages
-Kperform a Message Digest5 (MD5) checksum on the package
-f file or --file fileQueries or verifies the package that owns file


Question Answer
-i or --installInstalls a package
--configureReconfigures an installed package: runs the post-installation script to set site-specific options
-r or --removeRemoves a package but leaves configuration files intact
-P or --purgeRemoves a package, including configuration files
--get-selectionsDisplays currently installed packages
-p or --print-availDisplays information about an installed package
-I or --infoDisplays information about an uninstalled package file
-l pattern or --list patternLists all installed packages whose names match pattern
-L or --listfilesLists the installed files associated with a package
-S pattern or --search patternLocates the package(s) that own the file(s) specified by pattern
-C or --auditSearches for partially installed packages and suggests what to do with them


Question Answer
-kensure that the version number of the new package is the same
-dused to make Debian packages
-rused to make .rpm packages


Question Answer
killallterminates multiple processes running with the same name
pkillkill processes according to an extended regular expression pattern which can be based on process name and other attributes
-llist all available signal names
-iprompt you to confirm each process termination
SIGHUPterminates interactive programs and causes many daemons to reread their configuration files
SIGKILLcauses the process to exit without performing routine shutdown tasks
SIGTERMcauses the process to exit but allows it to close open files and so on


Question Answer
-jdisplays the process group ID and session ID
-auxview all running processes