Command Line Nuggets
I’m not a geek, so the command line isn’t my favorite place to play. But that is where the real power of Linux is. It is also where the real freedom is. There is little limit to what you can do while issuing commands on the CL. Where in the GUI you only have the choices that the programmer hard wired into the package. So here is a few of my favorite CLs.
I’m not going to bore you with the normal “cd”, “ls”, and the such like. They can be found in nearly every Linux tutorial on the net. So Here I’ll post the ones I’ve had to seek out and refine for my use.
Get a Terminal anytime
I guess the frist pet pev I have about Linux Gurus is that they just assume that I know how to get a terminal to type in. In most distros it’s easy enough. But there are some distros where you need to hunt for the terminal program. There is an easier way, which is mentioned often in tutorials and howtos, but that way has a little gotch ya.
To get into a termnial just use the Alt+Ctrl+F2. But here is the gotch ya! In all the tutorials I’ve read it’s never mentioned that while your in the GUI you use the right hand Alt+Ctrl. From the terminal you must use the left hand Alt+Ctrl. Now don’t get me wrong this isn’t an exact science. Some distros use different keymaps. But so does the terminal and the GUI use different keymaps.
The frist time I tried that Alt+Ctrl+F2, I got the login screen on my F2 terminal, but was unable to get back into the GUI because I was unaware that the terminal needed the left hand Alt+Ctrl+F7 to get back to my GUI. I ended up rebooting it was sometime before I figured this out on my own.
Now Like I said, it’s not an exact science. For example, I’m currently using OpenSuse 11 with KDE4, from the GUI I can use ether right hand or left hand Alt+Ctrl to switch to a terminal. But It still only works from the left hand to get back to my GUI. I’ve had some distros that the GUI only supported the right hand Atl+Ctrl.
Now you might ask why I use F2 in my example, well that’s because in most cases your F1 will be tried up. you see in the shell or terminal when you issue a shell command it doesn’t return to the command prompt until the job is finished. And your system booted in the frist terminal, then swtiched to terminal 7 when the GUI session was started. X or rather your GUI always runs on F7 and F1 is waiting for that session to end before it’s free. So that leaves F2, F3, F4, F5, and F6 for your use.
So from here on out you’ll know how to get a terminal even if you GUI session freezes.
I use rsync quit a bit, it is powerful tool to do backups. You can use it over the internet or network, but I use it for external hard drive backups, also synchronizing of my three PCs. So most of my data is in 5 copies at all times. Three PCs and two external hard drives.
I use two scripts one to backup my PC to the external HD. And one to synchronize my PC with the external HD.
# This line is for backing up the PC to the HD.
$ rsync -av --delete --stats /home/data/ /media/disk/data
# This line for synchronizing the PC with the HD.
$ rsync -av --delete --stats /media/disk/data/ /home/data
I put these lines each in a separate file and set them with executable permissions, then placed them in my bin, Now I just call up a short name to run that command instead of typing out the whole line each time.