Not yet answered
Marked out of 5.00
Flag question
Consider the following directory listing:
._x000D_ └── dir1_x000D_ └── subdir1_x000D_ └── file.txt
Your current directory is dir1. What is the resulting directory tree after running these commands:
[you@blue final]$ mkdir dir2_x000D_ [you@blue final]$ mv subdir1 ../dir2
Not yet answered
Marked out of 5.00
Flag question
You want to know how many regular files that end with the “.txt” extension exist in your home directory (including any subdirectory). Provide a command that will return that information.
For example, imagine this is a tree listing of your home directory:
._x000D_ ├── dir1_x000D_ │ ├── foo.jpg_x000D_ │ ├── hello.txt_x000D_ │ ├── hello.txt.bak_x000D_ │ └── subdir1_x000D_ │ └── bye.txt_x000D_ ├── dir2_x000D_ │ └── subdir2_x000D_ │ └── file.txt_x000D_ ├── file.pdf_x000D_ └── file.txt
When you run your command, the output should be:
4
Not yet answered
Marked out of 5.00
Flag question
Look at the following output:
total 16_x000D_ drwxrwxr-x 4 you you 4096 May 10 20:34 ._x000D_ drwxrwxr-x 4 you you 4096 May 10 19:35 .._x000D_ -rw-rw-r-- 1 you you 0 May 10 20:34 .bar_x000D_ drwxrwxr-x 3 you you 4096 May 10 19:56 dir1_x000D_ drwxrwxr-x 3 you you 4096 May 10 19:52 dir2_x000D_ -rw-rw-r-- 1 you you 0 May 10 19:51 file.pdf_x000D_ -rw-rw-r-- 1 you you 0 May 10 19:51 file.txt
which of the following commands produced that output:
Select one:
ls -l
ls -la
ls -lha
ls -lth
ls -lt
Not yet answered
Marked out of 5.00
Flag question
Provide a command that will output all the possible combinations with repetition of the characters a, b and c.
The output of your command should be:
aaa aab aac aba abb abc aca acb acc baa bab bac bba bbb bbc bca bcb bcc caa cab cac cba cbb cbc cca ccb ccc
Not yet answered
Marked out of 5.00
Flag question
Replace XXX with the appropriate argument in the following mkdir command so it will create the directories listed below:
[you@blue final]$ mkdir <strong><i>XXX</i></strong>_x000D_ [you@blue final]$ ls_x000D_ prod-docs-2001 prod-log-2006 qa-docs-2001 qa-log-2006 test-docs-2001 test-log-2006_x000D_ prod-docs-2002 prod-log-2007 qa-docs-2002 qa-log-2007 test-docs-2002 test-log-2007_x000D_ prod-docs-2003 prod-log-2008 qa-docs-2003 qa-log-2008 test-docs-2003 test-log-2008_x000D_ prod-docs-2004 prod-log-2009 qa-docs-2004 qa-log-2009 test-docs-2004 test-log-2009_x000D_ prod-docs-2005 prod-log-2010 qa-docs-2005 qa-log-2010 test-docs-2005 test-log-2010_x000D_ prod-docs-2006 prod-src-2001 qa-docs-2006 qa-src-2001 test-docs-2006 test-src-2001_x000D_ prod-docs-2007 prod-src-2002 qa-docs-2007 qa-src-2002 test-docs-2007 test-src-2002_x000D_ prod-docs-2008 prod-src-2003 qa-docs-2008 qa-src-2003 test-docs-2008 test-src-2003_x000D_ prod-docs-2009 prod-src-2004 qa-docs-2009 qa-src-2004 test-docs-2009 test-src-2004_x000D_ prod-docs-2010 prod-src-2005 qa-docs-2010 qa-src-2005 test-docs-2010 test-src-2005_x000D_ prod-log-2001 prod-src-2006 qa-log-2001 qa-src-2006 test-log-2001 test-src-2006_x000D_ prod-log-2002 prod-src-2007 qa-log-2002 qa-src-2007 test-log-2002 test-src-2007_x000D_ prod-log-2003 prod-src-2008 qa-log-2003 qa-src-2008 test-log-2003 test-src-2008_x000D_ prod-log-2004 prod-src-2009 qa-log-2004 qa-src-2009 test-log-2004 test-src-2009_x000D_ prod-log-2005 prod-src-2010 qa-log-2005 qa-src-2010 test-log-2005 test-src-2010
Not yet answered
Marked out of 5.00
Flag question
Recall the /etc/passd file, which contains a list of users and their properties. Provide a command that will print the user that has the highest user ID (when comparing using numerical value). For example, when run in blue.cs.sonoma.edu, your command should produce the following output (since user nfsnobody has the largest ID of 65534)
The user with the highest ID is nfsnobody
Not yet answered
Marked out of 5.00
Flag question
Provide a command that will assign the number of users in /etc/passwd to an environment variable called TOTAL_USERS.
Recall that environment variables can be verified by using the env command. For example, after running your command that sets the environment variable TOTAL_USERS, you can verify by executing the following command (there were 1077 users in blue when this question was written).
[you@blue final]$ env | grep TOTAL_USERS_x000D_ TOTAL_USERS=1077
Not yet answered
Marked out of 5.00
Flag question
Create a shell script that will take 1 argument and will end with a success exit code if the argument is a whole word in the /usr/share/dict/words file, and it will return an error signal of 1 if the argument is not a word on that file.
Your script should not produce any output
For example, if your script is called isvalid.sh, then you will see the following output (bad is a word in the dictionary, badd is not a word in the dictionary):
[you@blue final]$ ./isvalid.sh bad_x000D_ [you@blue final]$ echo $?_x000D_ 0_x000D_ [you@blue final]$ ./isvalid.sh badd_x000D_ [you@blue final]$ echo $?_x000D_ 1
Not yet answered
Marked out of 5.00
Flag question
In Lab. No 1 we made calls to the Internet Chuck Norris Data Base API using curl. Write a script that takes a joke number as an argument and prints the joke to the screen.
For example, if your script is called chuck.sh, then you should have the following output:
[you@blue final]$ ./chuck.sh 458_x000D_ Chuck Norris can write infinite recursion functions and have them return._x000D_ [you@blue final]$ ./chuck.sh 459_x000D_ Chuck Norris can solve the Towers of Hanoi in one move._x000D_ [you@blue final]$ ./chuck.sh 460_x000D_ The only pattern Chuck Norris knows is God Object.
Not yet answered
Marked out of 5.00
Flag question
The driver’s licenses in the island nation of Lilliput follow the format XYX-1111-A (three alphabetic characters followed by a hyphen followed by a four digit number, followed by another hyphen and finally another character that indicates the license type which can only be B for Bicycle, C for Carriage, D for Donkey Cart and A for All.)
Write a script that takes an argument and returns a success exit code if the argument is a valid Lilliputian drivers license or 1 if it is not a valid one. For example, if your script is called dlcheck.sh:
[you@blue final]$ ./dlcheck.sh ACV-13-A_x000D_ [you@blue final]$ echo $?_x000D_ 1_x000D_ [you@blue final]$ ./dlcheck.sh ACV-13119-A_x000D_ [you@blue final]$ echo $?_x000D_ 1_x000D_ [you@blue final]$ ./dlcheck.sh ACV-1319-A_x000D_ [you@blue final]$ echo $?_x000D_ 0_x000D_ [you@blue final]$ ./dlcheck.sh ACV-1319-Y_x000D_ [you@blue final]$ echo $?_x000D_ 1
WhatsApp us