Lab Assessment

profileNobody
Week8AdditionalLinuxCommands1.pdf

HIT172-2020-LinuxCommands-Week 8 – Asif_Karim/CDU/NT/AU

HIT172 - Week 8 Additional Linux Commands

Writing data to file (assuming the file test.txt is in Desktop):

echo: echo “Darwin is a bright and sunny place” > test.txt

Reading the file:

more: more test.txt

Appending data to file:

echo: echo “It is right on top” >> test.txt

Finding specific word in a file:

grep: grep right test.txt

grep -w right test.txt [finds the whole word]

grep -i darwin test.txt [ignores case]

Finding differences between two files:

diff: diff -y - test1.txt test.txt --suppress-common-lines

** create another file named test1.txt in the desktop and put only Darwin is a bright

and sunny place as the content in that file. The -y option removes some characters

from displaying and --suppress-common-lines makes sure only the differences

between two files are displayed.

Dynamic view of the current processes:

top: top

‘PR’ column in the output is the process priority, the lower the value, the higher the

‘priority’ of that process. Press ctrl+c to exit.

HIT172-2020-LinuxCommands-Week 8 – Asif_Karim/CDU/NT/AU

Calendar:

cal: cal

Viewing the commands executed so far:

history: history

Shutting the system down:

shutdown: sudo shutdown now

will power the system off then and there

Rebooting the system:

reboot: sudo reboot

Restarts the system

Rebooting the system after a specified duration:

shutdown: sudo shutdown –r +1

will start rebooting the system after 1 minute, the –r option restarts the system

instead of shutting down.

-----------------------------------------------------------