In: Computer Science
CAN YOU EXPLAIN THE OUTPUT.
awk ‘ { print $1 } '
ls –l | cut –c57-80 > /tmp/process_names.txt
who | awk ‘{print $1}‘ | sort –u | wc –l ps -ef | awk '{print $2}' person=`who | grep $1`
grep ERR app.log >/tmp/errors.txt
umask -S
1.awk '{print $1}'
Prints first field or column of the given file
2.ls –l | cut –c57-80 > /tmp/process_names.txt
output of ls -l (long listing of file) is given to the input to the command cut, which extract characters starting from 57 to 80
Note:'|' is pipe operator which pass output of one command as the input to another command
Those extracted 24 characters are stored into the file /tmp/process_names.txt using output redirection operator(>)
3. who | awk ‘{print $1}‘ | sort –u | wc –l ps -ef | awk '{print $2}' person=`who | grep $1`
who command displays a list of users who are currently logged into the computer, it is passed to the command awk ‘{print $1}‘ , which print the first column(username)
sort -u sort and remove duplicates of username
wc -l print no of lines in the information about all accessible processes returned by the command ps -ef,
4. grep ERR app.log >/tmp/errors.txt
grep command select all lines containing the pattern "ERR" from app.log and that is stored in /tmp/errors.txt using output redirection operator(>)
5. umask -S
display current mask symbolically