12 Practice Drills for the Linux Command Line

October 1, 2015 | Views: 23079

Begin Learning Cyber Security for FREE Now!

FREE REGISTRATIONAlready a Member Login Here

After watching the “The Linux Command Line Interface” Cybrary module, it’s important to practice the commands introduced in the module. What follows is a simple listing of commands you can run through on your own system(s) to build familiarity for the test and confidence on the command line. Down the road, it can be helpful to return to these commands from time to time.

Be sure to study the each command’s output to gain greater insight into their functionality. Don’t be afraid to play around with them (so long as everything is kept inside a VM, no serious harm will result!)

These commands were run on Lubuntu Linux by the user “david” on the machine “latitude-e6230” The default command prompt is “david@latitude-e6230:~$”.

 

1- parted

“parted” is a command-line partition manipulation program.

david@latitude-e6230:~$ sudo parted
(parted) help
(parted) print all
(parted) quit

 

2 – gparted

“gparted” is the graphical version of parted, but it’s not always installed by default.

david@latitude-e6230:~$ gparted
david@latitude-e6230:~$ sudo apt-get install gparted
david@latitude-e6230:~$ sudo gparted

 

3 – last

“last” lists user login events.

david@latitude-e6230:~$ last
david@latitude-e6230:~$ last reboot
david@latitude-e6230:~$ last david

 

4 – df

“df” reports filesystem disk space info.

david@latitude-e6230:~$ df
david@latitude-e6230:~$ df –help
david@latitude-e6230:~$ df -h

 

5 – free

“free” reports RAM usage info. “^C” stands for “ctrl+C”.

david@latitude-e6230:~$ free
david@latitude-e6230:~$ free –help
david@latitude-e6230:~$ free -h
david@latitude-e6230:~$ free -s 1
^C
david@latitude-e6230:~$ free -hs 1
^C

 

6 – ps

“ps” returns a snapshot of the current system processes.

david@latitude-e6230:~$ ps
david@latitude-e6230:~$ ps –help all
david@latitude-e6230:~$ ps -x

 

7 – kill

“kill” terminates processes. “21196” happened to be the process id (“pid”) of the terminal window.

david@latitude-e6230:~$ kill
david@latitude-e6230:~$ ps -x
david@latitude-e6230:~$ kill 21196

 

8 – find

“find” searches for files.

david@latitude-e6230:~$ find
david@latitude-e6230:~$ find Desktop
david@latitude-e6230:~$ find D*
david@latitude-e6230:~$ find *s
david@latitude-e6230:~$ find V???ualB*

 

9 – ifconfig

“ifconfig” configures network interfaces.

david@latitude-e6230:~$ ifconfig
david@latitude-e6230:~$ ifconfig wlan0
david@latitude-e6230:~$ sudo ifconfig wlan0 down
david@latitude-e6230:~$ ifconfig
david@latitude-e6230:~$ ifconfig -a
david@latitude-e6230:~$ sudo ifconfig wlan0 up

 

10 – cp

“cp” copies files and folders.

david@latitude-e6230:~$ cp /var/log/dmesg ./Desktop
david@latitude-e6230:~$ ls ./Desktop
david@latitude-e6230:~$ cp ./Desktop/dmesg ./Desktop/dmesg1
david@latitude-e6230:~$ ls ./Desktop
david@latitude-e6230:~$ cp ./Desktop/dmesg ./Desktop/dmesg1 .
david@latitude-e6230:~$ ls

 

11 – mv

“mv” moves and renames files.

david@latitude-e6230:~$ mv ./dmes* ./Desktop
david@latitude-e6230:~$ ls
david@latitude-e6230:~$ ls ./Desktop
david@latitude-e6230:~$ mv ./Desktop/dmes* .
david@latitude-e6230:~$ ls
david@latitude-e6230:~$ mv dmesg1 dmesg2
david@latitude-e6230:~$ ls
david@latitude-e6230:~$ mv dmesg dmesg2
david@latitude-e6230:~$ ls
david@latitude-e6230:~$ mv dmesg2 ./Desktop/dmesg.msg
david@latitude-e6230:~$ ls ./Desktop

 

12 – du

“du” returns the size of files and folders.

david@latitude-e6230:~$ du
david@latitude-e6230:~$ du -h
david@latitude-e6230:~$ du -h /var/log/*
david@latitude-e6230:~$ du -h /var/log
david@latitude-e6230:~$ du -h /proc/*
david@latitude-e6230:~$ du -h /proc
david@latitude-e6230:~$ du -c /
david@latitude-e6230:~$ du -ch /
david@latitude-e6230:~$ du -ch /home/david
david@latitude-e6230:~$ du -chd1 /home/david
david@latitude-e6230:~$ du -hd1 -t1M /home/david

 

By simply running through this commands once a day at intervals leading up to your test, their usage and meaning should make their way into your long term memory. From there, they can be recalled at will for the exam.

 

Have fun!

Save

Save

Share with Friends
FacebookTwitterLinkedInEmail
Use Cybytes and
Tip the Author!
Join
Share with Friends
FacebookTwitterLinkedInEmail
Ready to share your knowledge and expertise?
19 Comments
  1. nice listing of basic command bu t free -s 1 doesnt work free: seconds argument `1′ failed other parameters give the same result

    Linux kali-02HP6550 4.0.0-kali1-amd64 #1 SMP Debian 4.0.4-1+kali2 (2015-06-03) x86_64 GNU/Linux

  2. Is what I need, practice, practice, practice.

Page 4 of 4«1234
Comment on This

You must be logged in to post a comment.

Our Revolution

We believe Cyber Security training should be free, for everyone, FOREVER. Everyone, everywhere, deserves the OPPORTUNITY to learn, begin and grow a career in this fascinating field. Therefore, Cybrary is a free community where people, companies and training come together to give everyone the ability to collaborate in an open source way that is revolutionizing the cyber security educational experience.

Cybrary On The Go

Get the Cybrary app for Android for online and offline viewing of our lessons.

Get it on Google Play
 

Support Cybrary

Donate Here to Get This Month's Donor Badge

 
Skip to toolbar

We recommend always using caution when following any link

Are you sure you want to continue?

Continue
Cancel