Basic Linux Terminal Commands

pwd – print working directory, or what directory am I in?

Screenshot 2018-05-29 11.57.28

The user is in the root directory

ls – list directory contents, or what is in this directory?

Screenshot 2018-05-29 11.59.51

cd – change directory

cd Desktop/

man – show the manual page for a command, or what does this command do?

man ls

This will show information about the list directory contents command.

touch – create a text file

touch textfile

This would create a text file imaginatively titled ‘textfile’

cat – concatenate – I have only ever used this command to view files that I have created

cat textfile

This would display the contents of the textfile in the command line.

mkdir – create a directory

mkdir marc

This would create a folder or directory inside the current folder of marc

cp – copy a file, copies a file from one location to another

cp /Documents/textfile /Documents/marc/textfile

This will copy the text file from the Documents folder and place the copy in the /Documents/Marc folder.

mv – move a file, instead of copying a file, this will mv will move the file. Interestingly this can be used to rename files as well:

mv textfile differentName

Here is a screenshot of all the above commands in use:

Screenshot 2018-05-29 12.22.36

rm – remove

rm textfile

This would delete the textfile.

echo – display a line of text

Screenshot 2018-05-29 12.25.47

The above command displays and reveals an unfortunate truth.

To use echo to place text inside a text file:

echo Marc is going on a diet > differentname

The following screenshot shows the echo command placing the text that follows to the  differentname text file that was created earlier. Take note that I made sure that I was currently in the marc directory that was created earlier.Screenshot 2018-05-29 12.29.43.png

To add text to that file you must use the >> arrows. If you you use one arrow > you will replace the text.

> create or replace text in file

>> add or append to the text already in the file

See the following screenshot for more information

Screenshot 2018-05-29 12.48.51

ifconfig – this will tell you what your IP address is.

service network-manager restart – this will allow you to reboot your netwroking if you have swapped from bridged to host only networking and you want your kali installation to pick up the new IP address.

apt-get update && apt-get upgrade – this will allow to retrieve the available list of updates, and then once that is done the perform the upgrades.

apt-get dist-upgrade – this will perform a distribution upgrade, only execute this after performing update, and upgrade above.

apt-get autoclean – automatically clean up files that are no longer of any use.

One thought on “Basic Linux Terminal Commands

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s