p7zip Command Line

In CentOS to use p7zip  from command line the cmd is 7za and not p7zip or 7z, I wasted some time on this as most manuals online tell you to use p7zip [options] filename.

To extract a file you would do:

7za x filename.7z

You can substitute the .7z extension with whatever archive extension you are trying to xtract e.g tar,gz,zip etc as long as its an extension that can be handled by 7zip which should be most of the common formats.

Great Linux CMDs

In this post I will be making a list of great Linux cmd’s that I find all over the net one great place to stop by is commandlinefu.com they have a great deal of important linux cmd’s.

First cmd is mtr, it combines your ping and netstat cmd’s. In CentOS you have to su- to run this cmd:

mtr google.com

The following cmd I just started using recently and it has been a life saver I don’t know how I went all that time without it. The cmd is screen it works like your VNC or NX but for the terminal, it is especially handy if you SSH into your box but you don’t want to leave the terminal running waiting for a task to finish, you just start a screen run your cmd and detach from the screen. Now even if your connection gets disconnected or you disconnect yourself all you have to do when you connect again is run “screen -dR” and you are connected back to your earlier session and you can check on the progress of your task. To list screen instances “screen -ls”.

screen

Ctrl+a   ->pressing this twice moves to the next screen

Ctrl+a+c  ->adds a new screen to you screen instance

Ctrl+a+d ->detach from screen session

Ctrl+d  ->exit a screen

screen -dR   ->connect to/start a screen session

Mount a drive world writeable

mount -t ntfs-3g -o umask=000 /dev/drive /mnt/mountpoint

mount -t cifs -o umask=000,username=username,password=password //ipaddress/folder /mnt/mountpoint

by adding the option umask=000 any user can write to the mounted folder, this comes in handy when you want to write to a mounted drive as a regular user.  I have had a problem with some slack based distro’s not accepting this option in the current format and might need to play around with the mask cmd placement to see what works.

Update vs Clean Install

I just upgraded to CentOS 5.5 and while talking to a friend of mine we got into talking about updating vs clean install. After my update I had to restore to an image before the update as my mail system was not working, checked all packages contained in the update and zeroed the cause to a sendmail update. Which was disabling my current MTA “postfix”. I fixed that and another issue with my open office and I was ready to go. While my friend prefers to just do a clean install.

To me it just comes down to preference, if you have a heavily customized system it’s time saving to just do an upgrade, but if you are running a generic system with few modifications a clean install might be the best way for you.

Upgrading CentOS

Do a back up a recoverable system backup or a backup for all important docs you have on system before you proceed with the commands below

yum clean all
yum update glibc\*
yum update yum\* rpm\* python\*
yum clean all
yum update
reboot

Check  your  new version with :

lsb_release  -a

IP change notification by email

I had installed ipupdate while trying out dnsexit.com and loved its simplicity, dnsexit.com provides a great service but in the end I chose to stick with my current registrar lqconsulting who is a major supporter of Linux users, they also run linuxquestions.org of which am a member. I had tried to configure ddclient to work with my registrar but I did not have enough info about my registrar’s requirements of the client to work with their site. So in the mean time I have edited ipupdate to send me an email everytime my ip address changes while still doing evrything else it does. I prefer it this way over updating my registrar, since I do a lot of remoting in and it takes a few minutes before a new IP is updated to nameservers “around 20min”, but if I already have my new IP in my mail when it changes I don’t have to wait until nameservers update my site IP for me to be able to remote in. I have provided the edited file below for anyone who wants to use it also the tar,rpm and deb files that install it.

For install instructions go to:

My edited file
You can replace the installations ipupdate.pl with mine for v1.6-2 or just copy over my additions to them whichever works for you.

Trying out new distros

The one good thing about Linux is the range of distributions available. Every few months I will load a new Distribution on my flash drive or make a Live cd and try it out. I am currently trying out Linux Mint and I like it, I would definitely recommend it for new users it comes loaded with most apps that you need day to day. It’s eye candy is one of the best I have checked out so far, I even loaded it onto one of my old boxes that am planning on donating.

mount samba from linux

Do you have a linux box or you have booted of a live cd and you want to mount a samba share here is the command(s) for it.

#smbmount //ipaddress/share /mnt/moountfolder -o username=username,password=password

or

#mount -t cifs -o username=username,password=password //ipaddress/share /mnt/mountfolder

Any of the two methods above should work. You can use the name of machine instead of ip address if you want, and no space between username and password else you will get an error.

smbmount

Install mysql jdbc driver Linux

Am assuming you already have MySQL installed, download the MySQL Connector-J from their website.

Unzip/Untar the file and copy mysql-connector-java-version-bin.jar to java jre/lib/ext.  Doing this will allow the java interpreter to find the driver.