Monday 26 November 2012

How to use tail command in ubuntu

How to use tail commands in Ubuntu?


How to prompt last 3 lines of the file?

Lets show it on the example file: file.txt

How to show last three lines of the text file in ubuntu with tail command

One of the methods is to use tail command

tail -n X file.txt

where X is number of last lines which we want to prompt

tail -n 3 file.txt



How to prom[t last 3 lines of file in ubuntu with command tail

Wednesday 21 November 2012

How to mount usb stick in ubuntu?

How to mount usb drive in ubuntu


First of all plug the usb stick/drive to usb port in your computer

Type in the following command to list the accessible memories:

sudo fdisk -l

You will be given with the similar output:

Screen showing how to mount usb stick with use of command line interface in ubuntu

So now we know which device we want to mount

In this case it is /dev/sdb1 which is 4007MB (4GB) usb stick

Create directory where the file will be mounted

mkdir /media/usb_stick/

And mount your device in ubuntu to that directory

mount /dev/sdb1 /media/usb_stick/

And that is it!

Now you can browse the content of your usb stick just by entering this directory:

cd /media/usb_stick/

Friday 16 November 2012

How to change computer name in ubuntu?

How to change host name in ubuntu?


Get root privileges:

sudo -s

Open the following file:

vim /etc/hostname

Type in the host name in the opened file

Example of how to change the hostname in Ubuntu operating system - computer name.







Now save the changes and exit the file
 :wq

Sunday 11 November 2012

How to setup /etc/network/interfaces file in ubuntu

How to setup interfaces file in ubuntu?


Open interfaces file with text editor (I use vim)

sudo vim /etc/network/interfaces

Now you have two ways to setup your interface

1) setup int to DHCP - in this case interface is eth0:

auto eth0
iface eth0 inet dhcp


2) Setup interface with static IP address:
 
iface eth0 inet static
address 192.168.1.5
netmask 255.255.255.0
gateway 192.168.1.254



 Example on /etc/network/interfaces file in Ubuntu terminal - command line interface.

Penetration testing best company?



Sunday 4 November 2012

How to copy a file over the network

How to copy a file over the network?

 

To copy the files over the network in ubuntu the first step is to determine the ip address of the ubuntu machine where we are sending file to:

192.168.0.25

or the DNS name of this computer, for example:

bill-server


Then we have to know the username and password of the user on the destination machine where we are going to copy the files to:

username: chris
password: ****

Then we use scp  command. The structure of the command looks as follow:

scp /path/to/the/file username@IP.ADD.OF.HOST:/path/to/the/destination/directory/

for example:

scp /home/phil/Desktop/CV.pdf chris@192.168.0.25:/home/chris/Desktop/

Then we are asked to type in the password for user chris on 192.168.0.25

chris@192.168.0.25's password:

In case if working DNS the situation in similar, but instead of using IP address we use DNS name of the remote host:


scp /path/to/the/file username@NAME-OF-REMOTE-HOST:/path/to/the/destination/directory/

for example:

scp /home/phil/Desktop/CV.pdf chris@bill-server:/home/chris/Desktop/

Thursday 1 November 2012

How to check directory size


How do check directory size in ubuntu?

Run this simple command:

du -hs /path/to/the/directory/

For example:

du -hs /home/filip/Desktop/Music

Directory size command in Ubuntu exectuted in command line