Linux Blog

The Linux Command Line – Review

Filed under: General Linux,Linux for Newb's — TheLinuxBlog.com at 4:32 pm on Friday, February 24, 2012

Linux Command Line, A Complete Introductionwas given an opportunity to review The Linux Command Line, a Complete Introduction, by William E. Shotts, JR from No Starch Press and decided to give it a go. Being somewhat of a command line geek, I’m always on the lookout for good material to learn new and interesting things, and perhaps recommend to others. This is one of the better books I’ve read on the Linux Command line. It is easy to read and users with a little experience will find it has straight forward descriptions and examples. The book contains a lot of information and the only thing I’ve found lacking is diagrams, but if you’re not a particularly visual learner, this may work for you.

The book is intended to be read from cover to cover, which is exactly what I did (very rare for me, I tend to jump around.) It is not supposed to be a reference work, but more of a story. The story starts off basically enough, moving on to more advanced topics, finishing with shell scripting, though there may be some squabbling over the order in which it is presented. The gentle introduction to vi gives enough information on how to use it without being too overwhelming, and to be honest it covers just about everything I can remember how to do with vi without picking up a reference. Pretty much everything I’ve ever written in the Shell Script Sundays could be explained in this book, but as it wasn’t written as a reference, it doesn’t really work well as one.

If you’re new to the Linux command line you’ll walk away knowing what it is capable of; how to do all kinds of stuff that the “experts” do on a daily basis and probably more. For example, I can’t remember the last time I printed something from the shell. There is so much information contained within this book, you’re almost guaranteed to learn something, I did.

Automated Scanning with the Shell – UPDATE

Filed under: Shell Script Sundays — TheLinuxBlog.com at 10:00 am on Sunday, December 18, 2011

I wrote a little script a while back that would help to automate scanning from the shell.  Mark posted some suggestions that I’ll be implementing in this post. (Read on …)

WPA Wireless Networks from Shell

Filed under: Quick Linux Tutorials — TheLinuxBlog.com at 1:10 pm on Wednesday, April 20, 2011

Connecting to WPA networks isn’t the hassle it used to be, it is often very handy to be able to connect without the use of Network Manager. Today I’ll share with you a quick way to get connected to a WPA encrypted network from the shell.

(Read on …)

Optimizing Shell Scripts

Filed under: Shell Script Sundays — TheLinuxBlog.com at 6:30 pm on Sunday, January 23, 2011

optimizing shell scripts

I’ll be honest, I’m no expert on optimizing shell scripts. I’m hoping that readers will chime in with their tips / experiences. With that being said I do have a few tricks up my sleeve from hands on experience with code optimization using other languages.

(Read on …)

GNU find – A Multidimensional Tool

Filed under: Linux Software — TheLinuxBlog.com at 6:30 am on Tuesday, November 30, 2010

This is a guest post by Usama Hashimi. Usama is currently a student of MPhil in Economics and enjoys Learning about Linux, Surfing the Internet, watching movies and Listening to Music.

Beginners are mostly afraid of the command prompt. Whenever they see one, they immediately say “it’s very difficult”. But it’s not true. The command prompt is just as friendly as GUI, provided you use it with proper procedure.
Most people use GUI tools to search for their lost files. They don’t even know that they can use command line tools to search their files. GNU ‘find’ is such like a tool which can not only search files but can even copy, move or delete these files on the fly.
So let’s see that how ‘find’ works.
(Read on …)

Bash Tips for more efficient terminal usage

Filed under: Linux for Newb's,Linux Software — TheLinuxBlog.com at 5:36 pm on Monday, November 23, 2009

Here are some tips for working in the shell that I use on a daily basis. These may be known to most veterans, please contribute your favorite shortcuts to the comments. But for the most part this is not for the uber leet Linux geek, this is for those new to the terminal.

TAB
- Gives you suggestions / completes stuff for you. Type a, Press it twice, it will make your life a lot easier.

ctrl+w
- Remove word behind cursor.

ctrl+u
- Undo / Erase everything from cursor to beginning of the line

!!
- Type out whatever you typed out last, can be combined with tools like sudo

alt+f
- Go forward to the end of the previous word

alt+b
- Move cursor back to the beginning of the previous word

ctrl+d
- You’re done? Press ctrl+d to logout. If you’re in a virtual terminal, it may also close the window.

ctrl+z
- Stop the current process. Say you run gvim, and then you want to spawn another process. Press ctrl+z, then type bg. Once you’re done with the “other” process, you may type fg to bring it back into the foreground.

Why I Love Open Source Software

Filed under: General Linux — TheLinuxBlog.com at 10:32 pm on Thursday, April 10, 2008

Have you been looking for a piece of software that does exactly what you want it to? Perhaps its a tool for a client, or an application that would just make your life easier. On a daily basis I always am thinking of new things that I would like my favorite applications to do.

I am going to be writing within the next couple of days about my favorite CHM tools. One of the useful ones I use is a great little tool and it gets the job done, but it doesn’t do EXACTLY what I want. This is why I love open source. I can simple grab the source and change it if I need to. That is the freedom you are given.

Well, I’m not exactly the best C coder in the world but, given time if the application is that critical to me I can make the changes. I can get help from communities when needed and read free information on the web all day long to help me get the job done. If I can’t figure out how to do it in the language the application was written in its not a problem, I can analyze the source code and possibly find a work around. One powerful work around for the CHM application is the Shell.

This is one of the reasons I love open source software. There are many others, feel free to chip in and say why you love open source!

Linux ipconfig

Filed under: General Linux,Linux Software — TheLinuxBlog.com at 7:32 am on Thursday, December 13, 2007

I’m both proud and annoyed that there is no Linux ipconfig command:

owen@linux-blog:~$ ipconfig
-bash: ipconfig: command not found

I’m proud to be different but it annoys me because I like to see standards between operating systems. Luckily the Linux ipconfig utility is easy to remember. On most Linux distributions it is ifconfig. I’m not exactly sure why its called ifconfig but I remember it as the word “if” or “InterFace”. If you try to execute the command from your shell you might get this error:

owen@linux-blog:~$ ifconfig
-bash: ifconfig: command not found

If this happens don’t be alarmed the problem is probably that you are logged into your regular user account and not root. To run as root I would use sudo, or su to switch to the root user and try again. There is a trick to get ifconfig to work with a regular user but no changes to the configuration will be able to be made. The path to ifconfig and trick success rate varies by distribution, some high security distributions will not let you do this trick:

owen@linux-blog:~$ /sbin/ifconfig
eth0      Link encap:Ethernet  HWaddr 00:10:B5:70:B0:79
          inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1609257 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1640883 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:236511428 (225.5 Mb)  TX bytes:422972120 (403.3 Mb)
          Interrupt:11 Base address:0xee00
 
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:34516 errors:0 dropped:0 overruns:0 frame:0
          TX packets:34516 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:13210707 (12.5 Mb)  TX bytes:13210707 (12.5 Mb)

For an IPConfig that is a lot of data. If you know the interface that you want the data for, you can just specify the name with the command like so:

owen@linux-blog:~$ /sbin/ifconfig eth1

There is a lot more to this command then first meets the eye. I’ll go into detail about networking and the Linux ipconfig utility in another blog post. Thanks for reading, show me some love by leaving me a comment!

Checking your battery life from the shell

Filed under: General Linux,Linux Hardware,Quick Linux Tutorials — TheLinuxBlog.com at 8:46 am on Tuesday, December 11, 2007

I’ve often thought to my self “Wouldn’t knowing how much battery life I had be nice.”

Now when a window manager is open, this isn’t a problem. But when your just in a terminal it can be a bit of a problem. If you don’t get the gist of it heres an example, if I’m just in a terminal writing an article, or programming in VIM on battery life. Now I no longer have to execute the following command and guess how much life I have left:

 cat /proc/acpi/battery/BAT1/state

I simply run the command:

yacpi

It tells me all kinds of information about my power usage, what the current temperature is, am I plugged in, what CPU governor I’m using. Its a really neat tool. I would recommend for everyone to install it. Worst case scenario it can be used when the system is undergoing maintenance, or if you left your box sitting in the other room and need to check the battery live via SSH. Check out the screenshot:

YACPI Screenshot

To install it it will vary by distribution. I’m sure Debian has it in its XXXX number of packages which means Ubuntu probably has it too. To install on other distributions such as Gentoo or Slackware you’ll need the source. You can acquire the source from here: http://freshmeat.net/redir/yacpi/55486/url_homepage/yacpi
You’ll also need libacpi which can be found here: http://freshmeat.net/projects/libacpi/?branch_id=70062
Make sure you compile libacpi first, or the make will fail for yacpi.

That’s it, once you download the package and install or download and compile the source you’re good to go. Have a good time checking the battery life from the shell. Try doing that in DOS!