Linix-Question-2
Linix-Question-2
Question 10
Provide a command it outputs the content of the file ~jmora/lab09/mail-list sorted by the relationship field. Use only the sort command (no need to pipe the file or use stdin redirection)
The format of the file ~jmora/lab09/mail-list is described in https://www.gnu.org/software/gawk/manual/html_node/Sample-Data-Files.html and it is an adaptation from the sample data contained in it.
Question 11
Provide a command it outputs the content of the file ~jmora/lab09/inventory-shipped sorted ascending by the number of blue packages shipped. Use only the sort command (no need to pipe the file or use stdin redirection)
The format of the file ~jmora/lab09/inventory-shipped is described in https://www.gnu.org/software/gawk/manual/html_node/Sample-Data-Files.html and it is an adaptation from the sample data contained in it.
Question 12
Provide a command that outputs the number of orange bags shipped from the file ~jmora/lab09/inventory-shipped. Use only the cut command (no need to pipe the file or use stdin redirection)
The format of the file ~jmora/lab09/inventory-shipped is described in https://www.gnu.org/software/gawk/manual/html_node/Sample-Data-Files.html and it is an adaptation from the sample data contained in it.
Question 13
Provide a command that will print a list of usernames from the /etc/passwd file. Hint: the format of this file was studied on Lab 03.
Question 14
use the cut sort and uniq commands to obtain a list of the different shells that are assigned to users. Hint: the shell that is assigned to users is stored in the /etc/passwd file.
Your command should return the following output:
[you@blue ~]$ YOUR_COMMAND
/bin/bash
/bin/sync
/sbin/halt
/sbin/nologin
/sbin/shutdown
/usr/bin/bash
/usr/bin/zsh
Question 15
use the awk command to extract the file name and file size (in that order) from the output of the ls -l command. For this problem, do not worry about the fact that the ls-l prints a first line with the totals, this will result in an empty output line from your command.
[you@blue ~]$ ls -lh | YOUR_COMMAND
public_html 4.0K
quotes 4.0K
somefile.txt 46
texts 4.0K
texts.tar.gz 250K
wildcards 4.0K
Question 16
use the awk command to extract the file name and file size (in that order) from the output of the ls -l command. For this problem, we need to address the fact that the ls-l prints a first line with the totals, which if not handled will result in an empty output line from your command. Make sure that your awk command omits the totals line.
[you@blue ~]$ ls -lh | YOUR_COMMAND
public_html 4.0K
quotes 4.0K
somefile.txt 46
texts 4.0K
texts.tar.gz 250K
wildcards 4.0K
Question 17
using awk, provide a command that will print a list of users from the /etc/passwd file.
Question 18
Provide a command that uses awk to outputs the lines of the file ~jmora/lab09/mail-list that have a phone number that does not start with a parenthesis. Use only the awk command (no need to pipe the file or use stdin redirection)
The format of the file ~jmora/lab09/mail-list is described in https://www.gnu.org/software/gawk/manual/html_node/Sample-Data-Files.html and it is an adaptation from the sample data contained in it.
Question 19
Provide a command that uses awk , sort and uniq to output the phone numbers that are shared by more than one contact on the file ~jmora/lab09/mail-list. Your command should also print the number of contacts that have that number.
[you@blue ~]$ YOUR_COMMAND
3 (707)555-0542
2 (707)555-1234
2 (707)555-2127
The format of the file ~jmora/lab09/mail-list is described in https://www.gnu.org/software/gawk/manual/html_node/Sample-Data-Files.html and it is an adaptation from the sample data contained in it.
Question 20
The command free prints out a snapshot of the systems memory. Provide a command that uses it in conjunction with awk to print the Total Memory and the Available Memory in one line:
[you@blue ~]$ free -g
total used free shared buff/cache available
Mem: 125 2 83 1 39 120
Swap: 3 2 1
[you@blue ~]$ YOUR_COMMAND
Total Memory: 125G Available Memory: 120G
