Wednesday, 24 July 2013

Some useful Linux commands on Ubuntu

Some useful Linux commands on ubuntu: 

-r  (Recursive , it applies to all directory & sub directories )
Changing the Permission of the file .
chmod -r 777  /var/www/chicagoKid

Configuring Automatic DHCP when it is not configured by default when internet is not working :

ifconfig  - a  //Check IP  is shown or not

In order to configure DHCP address you will need to edit the 'interfaces' file /etc/network/interfaces .

auto eth0
iface eth0 inet dhcp

ctrl+c => cancel
ctrl+o ==>writer out //in terminal
Ctrl+x ⇒   Exit or quit .

Go to /etc/init.d/networking restart   // To restart network services

1)  you can use editor vi or gedit  to open any file.
2) User sudo whenever you need permission.

if you are required to be owner for all time, just open terminal and type
sudo nautilus


Check the ubuntu wheter 32 bit or 64 bit:
uname -a
Result for 32-bit Ubuntu:
           i386 GNU/Linux
whereas the 64-bit Ubuntu will show:
                        x86_64 x86_64 GNU/Linux

file /sbin/init

Creating Directory:

sudo mkdir -p /usr/local/java

Some useful commands:
pwd  :  print working directory
ls ~  → Shows file in your home directory
CD (Change Directory)
"cd /"     ⇒ Naviagate to root.
cd ~  ⇒ Navigate to home
cd .. ⇒  one level up
cd -  ⇒ Previous directory

cd ~/Desktop   ⇒ will move you to desktop directory

1) cp file foo  ==>Copy file & name it foo
2) cp -r directory foo == >Copy recursively the directory & paste into foo directory.

mv foo ~/Desktop   ==>Moves file  foo to desktop

rm: Use this command to remove or delete a file in your directory.

rmdir: The removes empty directory. To delete all directroy & its content use -r (recursive options)

mkdir ⇒ Make directory
man : ⇒ Lists Manual of other commands
eg : man mv ⇒ Will bring mv manual
sudo: The sudo command is used to perform file operations on files that the Root User would only be allowed to change.
df : File system disk spaces  usages  -h(human readable ) -s means "Summary"
free: tells amount of free and used space  -m(using megabytes)
 top ('table of processes')  : Displays running processes and system resources.
tab  : Auto completes any command

Paste  into terminal:
ctrl+v does not work  ⇒ User ctrl+Shift+v

History  : Lists command that you already typed

Add new user:
adduser newuserName
passwd  yourNewPassword