Question
Part I: Following the steps introduced in Lab 1 to log onto the host and then try the Linux basic commands discussed below Please save
Part I:
- Following the steps introduced in Lab 1 to log onto the host and then try the Linux basic commands discussed below
- Please save the screenshots of the examples and demonstrations in your lab 2, part I, to a pdf file and Please follow the screenshot format demonstrated in this document (2 points for format, 8 points for screenshots)
- Displaying the date and time
date
- Examples: (where $ is the prompt of the host)
- Display the current date and time (Central Standard Time: CST)
$ date
Sun Jan 16 16:23:42 CST 2022
$
- Display the current date and time in the Coordinated Universal Time (UTC, interchangeable with Greenwich Mean Time (GMT))
$ date --utc
Sun Jan 16 22:24:49 UTC 2022
$
- "date" prints the day of the week, month, day, time (24-hour clock Central Daylight Time (CDT) or Central Standard Time (CST)), and year.
- Every Linux command is ended with the pressing of the Enter key.
- Enter key says that you are finished typing things in and are ready for the Linux system to do its thing.
- Finding out who's logged in.
who:
- display information about all users who are currently logged onto the system.
- Examples:
$ who
cfs264sp2235 pts/0 2022-01-16 16:23 (73.94.237.97)
$
- pts number: a unique identification number the Linux system gives to each terminal.
- To display your login ID
$ whoami
cfs264sp2235
$
$ who am i
cfs264sp2235 pts/0 2022-01-16 16:23 (73.94.237.97)
$
- Displaying information.
"echo":
- display the information between the double quotes.
- Examples:
$ echo "Welcome to Metropolitan State University!"
Welcome to Metropolitan State University!
$
$ echo -e " Welcome to Metropolitan State University "
Welcome to Metropolitan State University
$
$ echo e "\tWelcome to Metropolitan State University"
Welcome to Metropolitan State University
$
$ echo e n "\tWelcome to Metropolitan State University" ; echo !
Welcome to Metropolitan State University!
$
- Please provide the screenshot(s) of the exercises listed on pages 1 and 2 below:
- Other fundamental commands:
- pwd: display the current directory
- file: find out the information about a file based on its contents
- touch: create or updates the modification and access times of files.
- rm: delete a file. It is unlikely that you could recover a file that you removed by accident.
- cat: create, view, or concatenate files.
- cp: copy a file.
- mv: move a file. It is also used to change the name of a file.
- cd: change directory.
- mkdir: create a new directory.
- rmdir: delete a directory.
- ls: display directories and files under the current directory.
- cal: display a calendar.
- man: display the online manual for the specified command.
- whatis: display one-line online manual description.
- whereis: locate a file in the system.
- history: display the commands you have executed previously.
- more: display a file page by page from the beginning of the file.
- less: display a file page by page from the end of the file.
- head: display a number of lines from the beginning of a file.
- tail: display a number of lines from the end of a file.
- stat: display file or file system status
- Create a new directory called lab2 as below:
$ cd
$ pwd
/home/students/cfs264sp22/cfs264sp2235
$ ls
Documents bin public_html skel
$ mkdir lab2
$ ls
Documents bin lab2 public_html skel
$
- Change the current directory to lab2 and displays what is under the directory as below:
$ cd lab2
$ pwd
/home/students/cfs264sp22/cfs264sp2235/lab2
$ ls al
total 8
drwxr-xr-x 2 cfs264sp2235 cfs264sp22 4096 2022-01-16 .
drwxr-x--x+ 13 cfs264sp2235 cfs264sp22 4096 2022-01-16 ..
$
- Under the current directory lab2, please follow the commands below:
- Check the current directory to see whether a file called test2 already exists
$ file test2
test2: cannot open `test2' (No such file or directory)
$
- Create an empty file called test2
$ touch test2
$ file test2
test2: empty
$
- Create a file called test3 that contains the current date and time
$ file test3
test3: cannot open `test3' (No such file or directory)
$
$ date
Sun Jan 16 16:44:51 CST 2022
$ date > test3
$ file test3
test3: ASCII text
$ cat test3
Sun Jan 16 16:44:51 CST 2022
$
- Create a file called test4 using the command cat
$ file test4
test4: cannot open `test4' (No such file or directory)
$ cat > test4
This is a test file.
^D
$ file test4
test4: ASCII text
$ cat test4
This is a test file.
$
- Please provide the screenshot(s) of the exercises listed on page 3 below:
- Create a file called test5 using the command cp.
$ file test5
test5: cannot open `test5' (No such file or directory)
$ cp test3 test5
$ cat test5
Sun Jan 16 16:44:51 CST 2022
$
- Modify a file:
$ file test2
test2: empty
$ cat test3 > test2
$ cat test2
Sun Jan 16 16:44:51 CST 2022
$ cat test4 > test2
$ cat test2
This is a test file.
$ cat test3 >> test2
$ cat test2
This is a test file.
Sun Jan 16 16:44:51 CST 2022
$
- Change the name of a file:
$ file test6
test6: cannot open `test6' (No such file or directory)
$ cat test5
Sun Jan 16 16:44:51 CST 2022
$ mv test5 test6
$ file test6
test6: ASCII text
$ file test5
test5: cannot open `test5' (No such file or directory)
$ cat test6
Sun Jan 16 16:44:51 CST 2022
$
- Delete a file:
$ file test6
test6: ASCII text
$ rm test6
$ file test6
test6: cannot open `test6' (No such file or directory)
$
- Display a calendar for Dec., 2022
$ cal 12 2022
December 2022
Su Mo Tu We Th Fr Sa
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
$
- Please provide the screenshot(s) of the exercises listed on page 4 below:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started