Monday, March 19, 2012

Useful Linux/Ubuntu Commands

Lately I have been doing a lot more Linux troubleshooting as I have been tasked to setup some new sniffer appliances. Below are some of the commands I have been using to assist me with the process. If you want to transfer files via ssh you can use Winscp if you are going from a Windows pc.

su = Become super user or another user.

cd = Changes the directory.

ls - l = shows you huge amounts of information (permissions, owners, size, and when last modified.)

cat = Allows you to look, modify or combine a file.

nano= Text Editor.(Easier to use then VI)

VI = Text Editor(Not for new users)

ifconfig = view information about the configured network interfaces

netstat -rn = Displays routing table for all ips bound to the server. Useful for seeing the default gateway


rm= Deletes a file without confirmation (by default).


Lets see some of the commands in action:



ubuntu@ubuntu:~$ ls -l
total 0
drwxr-xr-x 2 ubuntu ubuntu 80 2012-03-19 23:33 Desktop
drwxr-xr-x 2 ubuntu ubuntu 40 2012-03-19 19:19 Documents
drwxr-xr-x 2 ubuntu ubuntu 40 2012-03-19 19:19 Downloads
drwxr-xr-x 2 ubuntu ubuntu 40 2012-03-19 19:19 Music
drwxr-xr-x 2 ubuntu ubuntu 40 2012-03-19 19:19 Pictures
drwxr-xr-x 2 ubuntu ubuntu 40 2012-03-19 19:19 Public
drwxr-xr-x 2 ubuntu ubuntu 40 2012-03-19 19:19 Templates
drwxr-xr-x 2 ubuntu ubuntu 40 2012-03-19 19:19 Videos






ubuntu@ubuntu:~$ cd Desktop
ubuntu@ubuntu:~/Desktop$


ubuntu@ubuntu:~/Desktop$ ifconfig
eth0      Link encap:Ethernet  HWaddr 5c:26:0a:45:2e:36
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Memory:f6900000-f6920000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:60 errors:0 dropped:0 overruns:0 frame:0
          TX packets:60 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:4512 (4.5 KB)  TX bytes:4512 (4.5 KB)

wlan0     Link encap:Ethernet  HWaddr 00:24:d7:99:fc:f0
          inet addr:192.168.0.102  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::224:d7ff:fe99:fcf0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8129 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5385 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:7261637 (7.2 MB)  TX bytes:1267545 (1.2 MB)

ubuntu@ubuntu:~/Desktop$







ubuntu@ubuntu:~/Desktop$ netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.0.0     0.0.0.0         255.255.255.0   U         0 0          0 wlan0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 wlan0
0.0.0.0         192.168.0.1     0.0.0.0         UG        0 0          0 wlan0
ubuntu@ubuntu:~/Desktop$



ubuntu@ubuntu:~/Desktop$ ls -l
total 24
-rwxr-xr-x 1 ubuntu ubuntu  203 2012-03-19 19:19 examples.desktop
-rw-r--r-- 1 ubuntu ubuntu 4131 2012-03-19 23:42 readme.txt
-rwxr-xr-x 1 ubuntu ubuntu 8329 2012-03-19 19:19 ubiquity-gtkui.desktop

ubuntu@ubuntu:~/Desktop$ cat readme.txt
=== Plugin Name ===
Contributors: markjaquith, mdawaffe (this should be a list of wordpress.org userid's)
Donate link: http://example.com/
Tags: comments, spam

ubuntu@ubuntu:~/Desktop$ ls -l 

total 24
-rwxr-xr-x 1 ubuntu ubuntu  203 2012-03-19 19:19 examples.desktop
-rw-r--r-- 1 ubuntu ubuntu 4131 2012-03-19 23:42 readme.txt
-rwxr-xr-x 1 ubuntu ubuntu 8329 2012-03-19 19:19 ubiquity-gtkui.desktop
ubuntu@ubuntu:~/Desktop$ rm readme.txt


ubuntu@ubuntu:~/Desktop$ ls -l
total 16
-rwxr-xr-x 1 ubuntu ubuntu  203 2012-03-19 19:19 examples.desktop
-rwxr-xr-x 1 ubuntu ubuntu 8329 2012-03-19 19:19 ubiquity-gtkui.desktop
ubuntu@ubuntu:~/Desktop$ 


Recommended links:


Unix, Linux, and variants

WinScp

No comments:

Post a Comment