Categories
Technical

Ubuntu: My day-to-day Linux commands

And now a bit of the day-to-day Linux commands I use in Ubuntu 

ls -l
This the most common command that all *nix users use to show the file(s) in list format.

rm -rf <filename(s)>
To delete a file, use this command. Be careful, no retrieval will help you to get your file.

/etc/init.d/networking restart
I use to do this just to restart my networking everytime I make some changes on /etc/network/interfaces or just to restart ethernet to get a new IP from DHCP server.

ping <hostname>
To make sure that you’re connected to the internet, use this command to test your connection to <hostname>. Example:

~# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=1 ttl=251 time=14.4 ms
64 bytes from 8.8.8.8: icmp_req=2 ttl=251 time=14.9 ms
64 bytes from 8.8.8.8: icmp_req=3 ttl=251 time=15.4 ms
64 bytes from 8.8.8.8: icmp_req=4 ttl=251 time=17.7 ms

— 8.8.8.8 ping statistics —
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 14.487/15.655/17.796/1.280 ms

cat <filename>
To show the content of <filename>

dpkg-reconfigure <package_name>
Debian uses this command to configure some packages configuration.

apt-get install <package_name>

apt-get update && apt-get upgrade

To make sure you have the latest package list, use the command apt-get update and to upgrade your package to the latest version use command apt-get upgrade or you can just use both command in one single line.

apt-get remove <package>
To uninstall package, use the above command.

dpkg -P <package>
Sometime some configuration file(s) are not completely removed. Use this command to clean all the file(s) related to the package

dpkg -l | grep <>
To see what kind of package(s) is or are installed use the command

dpkg -l or if you need to know whether you have installed package X or not you can simply use dpkg -l | grep X

grep <word> <filename>
If you need to know whether in <filename> contains this <word> you can use this command.

:> <filename>
To empty or erase the content of <filename>

locate <filename>
This is for finding <filename> using file list database.

du -h
If you can’t see how big the size of your directory is using ls -l, use this command.

df -h
This is to list the mounted partition available on your computer.

traceroute <hostname|fqdn>
To check how ‘far’ your computer from <hostname|fqdn>