Sunday, February 23, 2014

KDE Desktop Shortcuts

Heres another duh, don't I feel stupid moment. I run KDE Plasma and the last time I tried to make shortcuts on my desktop I just couldn't do it. I figured o.k. drag and drop the icon from the application launcher onto the desktop and done. That's what I tried and it just didn't work. No matter how many times I dragged the icons to the desktop they just disappeared.  I figured well it's Linux so I probably have to do some weird configuration and link the icons or something.

Today I planned on spending the afternoon getting some shortcuts in order. Well guess what ? It is that simple. Drag and drop the icons onto your desktop from either application launcher, or Dolphin and your done. The only trick you need to know is this , make sure you right click on the desktop and select unlock widgets if its set to lock. Once you click unlock widgets, drag and drop the icons of the programs you want from your application launcher or Dolpin to your desktop and your done ! Easy peazy baby.

Now I've got all the programs that I use on a regular basis grouped together. For my webdesign and surfing the net I have Firefox and Chrome for social networking and checking design work, FileZilla for FTPing , and Dolphin to manage my files.

I made a second group, with Gimp, and Inkscape for my graphic design stuff, and through Gedit in the mix for coding out websites. This configuration is a real time saver for me.




Sunday, February 9, 2014

Three Ways To Get Help From The Command Line

Most people that use Linux know about and use the man pages. If you're not familiar with man pages there pretty simple to use. Open up the terminal program of your choice, at the command prompt simply type man followed by the subject you want to learn about. For example:

man finger

By typing this at the command prompt man will pull up all the information on using finger. What it does, how it works, and how to use it. To close the particular man page just press the q key and the terminal will quit man and return you to the command prompt.

There's a man page for just about everything in Linux. Want to learn more about the unzip program in my last post. Type man unzip. When your done press the q key and it will return you to the command prompt.

O.K. most people know about man pages and if you didn't, well now you know. There is also a help command that does , you guessed it... helps.If you type help help at the command prompt it will bring up some info on using help. Use help when your not sure about what a command does. For example try this.

help pwd

This will pull up a little info on the pwd command. Help isn't as in depth or massive as the man pages, but from time to time when your stuck, sometimes help can really help.

Finally we have the info command. Want to learn more about using man pages, type info man. This will bring up, you guessed it ... info on man pages. Again just hit the q key to return to the command prompt.Here's some fun things to info

info vi
info bash

You get the point. These are three easy things you can do to get help directly from the command line. This can really save your life when your in a pinch. It can make for some dry reading but you'll be surprised at what you can learn from some of these man, info, and help pages.

Saturday, February 8, 2014

Using unzip in the command line for multiple zip files

One reason for using Linux and the command line in a terminal program is the amount of time you can save doing redundant tasks. One of my resolutions for 2014 was to start using the command line more, to save time and of course learn a few tricks.

Today I tried two new things I never did with the command line. The first one was a total fail, and I'll shamefully explain what I tried to accomplish. The other thing I did was a success and saved me about a half hour of work.

The first thing I tried was downloading a bunch of zip files from a website at the same time, or with one command. There were roughly 30 zip files I needed to download, and I was planning on using wget to download all the files while I worked on other things. I have no clue what went wrong, but no matter what I tried, I just couldn't get wget to get the zip files I needed. I think it had something to do with the websites php server and some security features set on the server end. I'll be trying this again because I know it can be done, I'm fairly sure I was doing it correct, I just had to tweak something. I'll try it on an easier project in the future. So that was the fail.

Now for the success. I downloaded the 30 zip files manually, and placed them all in a temp directory. Normally I use Ark in KDE and it works great but unzipping 30 files with Ark would of taken at least 20 to 30 minutes. Instead I used "unzip" from the command line and it took about 30 seconds!!! The files I'm unzipping are jpg image files, so the filename really isn't that important, as long as I don't overwrite the duplicates and lose them.

Not knowing what I was doing I made a dir called temp-test and copied all the files to the temp-test directory I created. Then for the sake of simplicity and not making this post overly complicated and confusing for anyone newer to this like me, I used unzip -B "*.zip" and unzip did the entire job in about 30 seconds. I now had every file unzipped and ready to use.

A couple things worth mentioning. You need the quotes around the "*.zip" so that the shell won't recognize it as a wild card. Without the quotes I got

caution: filename not matched:  filename.zip

I also needed to ad the -B modifier to add a ~ to the end of any duplicate filenames. This left me with 300 files with duplicate names, but I unzipped over 1000 files. So I got a little more than a third of my files in 30 seconds.

This is the command I used.

unzip -B "*.zip"

unzip is the command to unzip the file, -B is the modifier to make a backup of duplicate named files. So if you have multiple files named 03.jpg it will create a backup of 03.jpg~ 03.jpg~1 etc. etc. Finally the "*.zip" is the wild card to unzip every file with the .zip extension.

If you have no duplicate file names in your multiple zips that's great. I had some duplicate names, which left me with close to 300 backup files that I needed. I couldn't figure out how to fix this using the command line, but a quick fix using the Dolphin file manager, (I think this will work with any file manager though) was to move all the backup files into its own folder and then highlight them all, right click and select rename, this will pop up a window that will allow you to add a filename#. The hashtag will add a sequential number. So I named it dupe#.jpg which created dupe1.jpg dupe2.jpg up to 300. Luckily they were all jpg's, any name would work as long as I had the jpg extension, and this technique worked great.

I do a lot of image work so this worked perfectly for me. All in all, what took a few minutes with unzip and renaming the dupes in Dolphin would of took about 20 to 30 minutes using Ark. I'll be using this a lot for different work projects.