Basic Linux TutorialIntroduction – What is it? Why to learn? Linux installation directory structures Boot process Run levels in Linux Desktop Environments Different shells BASH Internal and External Commands Basic Linux Commands Important files and directories in Linux Environmental and Shell Variables Command history in Linux Character classes in Linux Text editors vim nano Searching files Creating new files Viewing File Contents File commands File permissions and ownership WildCards (Globbing) in files File compression Directory commands xargs command in Linux Comparing files Searching patterns using grep command Translating the characters using tr command Extracting data using cut command Stream editing using sed command Data extraction and reporting using awk command Sorting the file or string input uniq command in Linux Difference between grep, tr, cut, sed and awk commands Hardware commands Hard disk and memory space commands Working with Processes Managing Jobs Working with cron jobs Service command in Linux Network commands Managing Users and Groups Other Popular commands Standard streams and Redirection Pipes Package Managers in Linux
Extracting data using cut command in linux shellcut command allows you to extract specific portion of a line in a file. Examples of cut command.
cat /etc/passwd | cut -d: -f1 # This command will display first column from the file /etc/passwd. Here f stands for field. d stands for delimiter. cat /etc/passwd | cut -d: -f1,2 # This command will display first 2 columns from the file /etc/passwd. cut -c2 <filename> # This command will extract and show second character from each line of a file cut -c1-4 <filename> # This command will extract and show first 4 characters from each line of a file cut -c4- <filename> # This command will extract and show all characters starting from 4th character from each line of a file cut -d’:’ -s -f1 <filename> # This command will not display line of there is no delimiter found in the line. “-s” stands for suppress. cut -d’:’ –complement -s -f1 <filename> # This command will complement the output. That means it will display all fields from the lines except field 1. cut -d’:’ -s -f1,2 –output-delimiter=’@’ <filename> # This command will display different delimiter in output.
Web development and Automation testing