Assignment: Perform simple linux commands and capture a \"screen shot\" of the o
ID: 3715297 • Letter: A
Question
Assignment: Perform simple linux commands and capture a "screen shot" of the output
Requirements: Provide a series of "screen shots" of your Linux console that shows the following:
· From you home directory, create some nested directories called one/two/three. Use the "tree" command to show that it worked
· Descend into the "two" directory and copy the /etc/passwd file there
· Move the passwd file from the "two" directory to the "one" directory. Use "ls" to show that it's there
· Create some empty files at the "two" directory called "test1", "test2", and "test3". Use "ls" to show that they are there
· Show the long file listing of just test1 and test2 using wildcards
· From the home directory, show the long listing of one/passwd file
· From the home directory, delete the one/passwd file. Use "ls" to show that it's gone
· Show the manual page for the "mkdir" command
· Show the manual page for the "mkdir" API function
· Create an alias called "home" that does two things... returns you to your home directory, then does a long listing of all files found there
· Create a file called "Output.txt" that contains the output of the "ls /etc" command
· Using "cat", create a file called "poem.txt" where you enter at least one line of text ("Mary had a little lamb" will do...)
· Using "cat", pipe the contents of poem.txt into the "wc" command to count the number of words
· Using "cat" and "grep", display only the lines in /etc/passwd that has contain your user name
· Display the last 5 lines of the /etc/passwd file
Explanation / Answer
Please find the follwing commans. Please let me know if you found any issue.
[root@localhost lnxip]# tree one
one
??? two
??? three
2 directories, 0 files
[root@localhost lnxip]#
[root@localhost lnxip]# cd one/two/
[root@localhost two]# cp /etc/passwd .
[root@localhost two]#
[root@localhost two]# ls
passwd three
[root@localhost two]# mv passwd ../
[root@localhost two]#
[root@localhost two]# ls
three
[root@localhost two]# cd ..
[root@localhost one]# ls
passwd two
[root@localhost one]# pwd
/home/lnxip/one
[root@localhost one]#
[root@localhost one]# cd two/
[root@localhost two]#
[root@localhost two]# touch test1 test2 test3
[root@localhost two]#
[root@localhost two]# ls
test1 test2 test3 three
[root@localhost two]#
[root@localhost two]# ll test* | grep -v 3
-rw-r--r--. 1 root root 0 Apr 24 21:48 test1
-rw-r--r--. 1 root root 0 Apr 24 21:48 test2
[root@localhost two]#
[root@localhost two]#
[root@localhost two]# cd ..
[root@localhost one]#
[root@localhost one]# cd ..
[root@localhost lnxip]#
[root@localhost lnxip]# cd one/two/
[root@localhost two]#
[root@localhost two]# ls -l test* | grep -v 3
-rw-r--r--. 1 root root 0 Apr 24 21:48 test1
-rw-r--r--. 1 root root 0 Apr 24 21:48 test2
[root@localhost two]#
[root@localhost two]# cd ../..
[root@localhost lnxip]#
[root@localhost lnxip]# ls -l one/passwd
-rw-r--r--. 1 root root 2409 Apr 24 21:46 one/passwd
[root@localhost lnxip]#
[root@localhost lnxip]#
[root@localhost lnxip]# rm -f one/passwd
[root@localhost lnxip]#
[root@localhost lnxip]# ls -l one/
total 4
drwxr-xr-x. 3 root root 4096 Apr 24 21:48 two
[root@localhost lnxip]#
[root@localhost lnxip]#
[root@localhost one]# man mkdir
[root@localhost one]#
[root@localhost one]# man 3 mkdir
[root@localhost one]#
[root@localhost lnxip]# alias home="/home/lnxip ; ls -l"
[root@localhost lnxip]#
[root@localhost lnxip]#
[root@localhost lnxip]# home
bash: /home/lnxip: Is a directory
total 110432
-rwxr-xr-x. 1 root root 976 Oct 27 2016 firefox38
drwxr-xr-x. 3 root root 4096 Apr 24 21:53 one
[root@localhost lnxip]#
[root@localhost lnxip]#
[root@localhost lnxip]# cd one/
[root@localhost one]#
[root@localhost one]#
[root@localhost one]#
[root@localhost one]# ls /etc >Output.txt
[root@localhost one]#
[root@localhost one]#
[root@localhost one]# cat >poem.txt
Mary had a little lamb[root@localhost one]#
[root@localhost one]#
[root@localhost one]# cat poem.txt
Mary had a little lamb[root@localhost one]#
[root@localhost one]#
[root@localhost one]#
[root@localhost one]# cat poem.txt | wc
0 5 22
[root@localhost one]#
[root@localhost one]#
[root@localhost one]# ls
Output.txt poem.txt two
[root@localhost one]#
[root@localhost one]# cat /etc/passwd | grep -i lnxip
lnxip:x:1002:1002::/home/lnxip:/bin/bash
[root@localhost one]#
[root@localhost one]#
[root@localhost one]#
[root@localhost one]# tail -n 5 -f /etc/passwd
apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin
earth:x:1003:1003::/home/earth:/bin/bash
interviewbit:x:1004:1004::/home/interviewbit:/bin/bash
systemd-journal-gateway:x:191:191:Journal Gateway:/:/usr/sbin/nologin
office:x:1005:1005::/home/office:/bin/bash
^C
[root@localhost one]#
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.