Hot tips to get the best of Linux in 2008

Sometimes you can have a frozen window, and there are two fast ways to solve this problem without turning off your computer or restarting it. The first is the traditional key combination of Ctrl + Alt + Backspace.

Linux

Wallpaper from Deviant Art

LinuxPowerful.OpenSource.Secure (Can you name the Distro’s in the Picture?)

At the onset of this new year – 2008 – I would like to share some Linux tips with you. It won’t matter which version are you using because I’ll talk mostly about the Linux Console. Most common windows user will probably feel the console in Linux to be a little intimidating, nevertheless when the time comes, you’ll notice that it is the best way to be highly productive.

Read, practice the following instructions to get yourself comfortable with Linux;

1. Avoid out of the session or close the terminal with the command Ctrl+D

  • set -o ignoreeof Enable Ctrl+D
  • set +o ignoreeof Disable Ctrl+D

2. The Alias — We introduce a command with an alias, and the shell will recode it with its value. For example, whether we define an alias this way: alias buscar=”find. -name”, when we input commands in the line buscar name_file the shell will execute find. -name name_file and will seek the file we ask starting in the current path.

Alias name_of_the_alias="command_which_will_execute_the_alias".

To disable an alias use the command unalias: unalias name_of_de_alias. If you want to see the alias defined in the system just write: alias.

3. Most recently used commands — Execute the following instruction in the console:

history|awk '{print $2}'|awk 'BEGIN {FS="|"} {print $1}'|sort|uniq -c|sort -rn|head -10

The history command shows a list of all recently executed commands. You can use the arrow keys to navigate the next and previous commands.

Tux4. Kill all the process in a determined application — This command will be very useful when you are running programs which tend to drag on the system resources. Open terminal and type: ps aux c. It will show you a complete list of running processes. The first column contain the user owner of the process, the second one is the PID of the process and if we jump to the last column we will see the name of the application which belong to each processes. If the application you want to kill is, for example, Firefox, then it would be: ps aux c | grep firefox and then write kill -9. The next time you do a ps aux c | grep firefox, this program shouldn’t appear anymore.

5. Get the basic system information — There are some commands you can use to determine basic information of your machine such as kernel version, hardware information and others. The following command lines shows what they’ll return when executed;

$ cat /proc/version  = "It returns a full string of information"
$ uname -m = "The result of the machine's number"
$ uname -r = "Show the version of the kernel"
$ uname -n = "Returns the local domain name"
$ uname -s = "Will show the system name"
$ uname -p = "It tells you the type and name of the processor"
$ uname -a = "Will show all the information above and also the date and time of the system"

6. Use the Calendar — With the following commands you can have different views and displays of the Calendar in the different versions of Linux.

cal -3 = "Simply display the calendar"
cal 1 2008 = "This command display a calendar of a particular month of the year"
date -d fri = "Display the date of the next on the current or next week"
date --date='25 Dec' +%A = "Tell you which day will be Christmas this year"

7. Disk Space — Having sufficient and optimized disc space is something vital for good performance of your system. In the case of Linux, here are the different ways to optimize your storage space and display information of your hard disc.

df -h = "This command display the free disc space"
fdisk -l = "Very similar to Windows environment show you the partitions of the disc"
ls -lSr = "Display the all the files and the biggest last"
du -s * | sort -k1,1rn | head = "Show top disc users in the current directory"

8. Set Operations — In Linux you can make operations with files quickly. Test the following commands which help you a lot to manipulate files.

LANG=C sort file1 file2 | uniq" = "Make the union of unsorted files"
LANG=C sort file1 file2 | uniq -d = "Intercept unsorted files"
LANG=C comm file1 file2 | sed 's/^\t*//' = "Union of sorted files"
LANG=C comm -3 file1 file2 | sed 's/^\t*// = "Symmetric difference of sorted files"

9. Text Manipulation — Manipulation of text is another very important aspect of the work. Let’s see some of this in Linux.

sed -n 's/.*<title>\(.*\)<\/title>.*/\1/ip;T;q' = "Extract title from an HTML page"
sed -n '10,20p;20q' = "Print lines from 10 to 20"
sed ':a; /\\$/N; s/\\\n//; ta' = "Concatenate lines between \"
sed 's/[ \t]*$//' = "Remove trailing spaces from lines"
sed 's/string1/string2/g' = "Replace string1 with string2"

10. Searching of Files — Faster method to search for almost anything under a Linux platform.

alias l='ls -l --color=auto'page" = "Make a quick  listing of directories"
ls -lrt = "List files by date"
find -name '*.[ch]' | xargs grep -E 'expr' "Search 'expr' in the current directory and below"
find -type f ! -perm -444 = "Find files not readable by all"
locate -r 'file[^/]*\.txt' = "Search cached index for names"

11. Frozen Windows — Sometimes you can have a frozen window, and there are two fast ways to solve this problem without turning off your computer or restarting it. First, you can try the traditional key combination of Ctrl + Alt + Backspace.

The other way is a little more complicated than the previous one but is more efficient. Hit Ctrl + Alt + F2 to jump to the virtual console. Then log in with your user name, password and type the following:

ps -ax | grep startx

This executed command will provide you the PID of your Xserver. Then kill it with the next command

kill -9 PID_Number

If you want return to your first console, just press Alt + F1.

12. Remote Execution — With the service “rexec” you can have remote execution, very useful when you are working on a network environment. The user using this service must authenticate with a user name and password.


Don't like it? There are lots of published articles, pick a random one.

Brajeshwar posted this article on Fri, Jan 4th, 2008 at 7:40 pm
Categorized under Featured, Technology and has the following tags

Prev Article:

Next Article:

Archives: Visit the Archives for more articles.

Comments Post Yours

There are View Comments so far. You can follow any responses to this entry through the RSS feed. You can leave a response, or trackback from your own site.

  1. Nice list of commands. Even for an experienced Linux user they make a good reference.

  2. For a frozen window, why wouldn’t you just do a Ctrl+Alt+Esc and click on the frozen window?

    You like doing things the difficult way, eh? ;)

  3. Set operations is good one. I had used Linux for 3 yrs till 2005. It was a good experience. These commands will be useful.

  4. Isn’t “rexec” quite dangerous to use in the real world as it transmits your password un-encrypted, better to use ssh or something encrypted.

    But interesting list, thanks

  5. Awesome. So many of these commands, I’m familiar with, but I can never recall them when I need them most. It’s nice to have a whole bunch of useful ones on one page to bookmark. Thanks.

  6. I would suggest to use xkill instead to kill a dead/frozen window. xkill has been around since the beginning of xwindows, and still works very well now.

  7. Tips from somebody who suggest “kill -9″ ???

    DON’T USE kill -9 !!!

    kill -9 abort a program and can be very dangerous!!

    Davide

  8. Use join instead of comm and you don’t need the sed.

  9. Havent used linux for a while to be fair but this is useful.

    And i have to agree with davide using kill 9 killed me too! ive learnt from that mistake i hope dont do it!

  10. You just ripped this off from:
    http://www.pixelbeat.org/cmdline.html

    Then you added some of your own “wisdom”
    like `kill -9` and `rexec`. laughable.

  11. @Brady
    I don’t think Hector (the author of this article) needed to copy from you. He is a Linux System Engineer working for a reputed company and the commands are perhaps what most *nix user would know.

    Btw, you got a good printable version out there and I hope other readers will like it. (Yours is a good resource and I don’t needed to moderate your link nor your text.) :-)

  12. Ctrl+Alt+Esc and click on the frozen window works for me to kill iceweasel when it freezes.
    Then to restart it I also have to do:
    ps -ef | grep iceweasel
    then I kill the number of the iceweasel/firefox/bin process.

    “kill 2209″ for example, then I can restart iceweasel without having to reboot.

  13. ConcernedFellowBlogger January 24th, 2008 at 11:00 pm 13

    Your copyrighted content has been stolen:

    http://googit.blogspot.com/2008/01/hot-tips-to-get-best-of-linux-in-2008.html

  14. Well, you can’t really help and this isn’t the first case. There are lots of blog scrappers. This one seems to be copying everything blatantly.

  15. Hello

    Instead of ps | grep , you can use pgrep which does pretty much the same in shorter… then use pkill which will signal the matching processes.

    Cheers,

    Stephane

  16. Regarding tip no 11, instead of
    ps -ax | grep startx

    you can use the easier to remember
    pgrep startx

    to get the PID of your XServer

  17. You dont have to resort to terminal if you have a frozen window infront. Just:

    Alt+F2
    Type “xkill”, enter
    Now click on frozen window.

  18. mostly a frozen window, any way in my experience, occurs because compiz is activated and there is a conflict with the drivers or the video card is a little old. If you disable compiz, or play around with it enough, you will most certainly realize a compromise between functionality-beauty-stability.
    Closing a window that has freezed, well temporarly freezed, is not an option by me since it only occurs with firefox, or HD movies, and it is frozen for a few seconds, so it would be like going with a bazooka to hunt a fly.
    But the other suggestions are quite nice.

Post yours

blog comments powered by Disqus

Sidenotes

Quick notes, scribbles, somehow related to this website and to what I do. Or perhaps I'm just plain lazy to make them into a full article.

12 Hottest Geek Girls on Twitter

So, you have seen the 12 Hottest Geek Girls (via Digg). However, they forgot to link them to their Twitter profiles so you can follow them. Well, here they are -- the 12 Hottest Geek Girls ...13th Oct, 2009

Great Indian Developer Summit 2009

I got a Press Release of the upcoming GIDS '09 and here is an excerpt. The summit's program covers Java, REST, Unit testing, Groovy, Spring, Struts 2.0, SOA, Cloud Computing, Web Services, JRuby, RoR, Ruby, JVM, ...21st Jan, 2009

The flourishing gun market in Pakistan

VICE Travel: Darra, Pakistanby Top-Notch112 (Via: Deep Green Crystals) 20th Jan, 2009

Angry Ringtone for iPhone and others

[audio:http://audio.brajeshwar.com/angry-ring-ring.mp3] The ANGRY RINGTONE for iPhone. (Click the PLAY button above!) Download * iPhone Ringtone (.m4r) * MP3 Ringtone (.mp3) * Zipped (both .m4r and .mp3) To use it as an iPhone Ringtone; just double click the file "angry-ring-ring.m4r" and it ...15th Jan, 2009

IIM Ahmedabad's Leverage 2009

Leverage, the Venture Capital and Private Equity Club of IIM Ahmedabad and the Centre for Innovation Incubation and Entrepreneurship bring to you the 1st edition of the Venture Capital and Private Equity Conference on the ...12th Jan, 2009

View the Sidenotes Archive

Play the Penguin Game

Recommended

  • Ode to Apple Dedicated to Apple – Mac, iPhone, iPod, iTunes, Quicktime, Apple TV and all the awesome softwares for the Apple Mac.
  • Not Safe for Work Ever clicked a link and felt embarrassed with the content in front of your co-workers? Ever caught unaware because the funny link your friend sent was a little beyond funny? Let’s minimize that with NSWF.
  • ActionScript 3.0 Reference Flash/Flex ActionScript 3.0 Reference.
  • AS 2.0 Reference Reference for ActionScript 2.0 Programming Language used in Flash. Primarily stashed here for my own personal reference.
  • o! Just Me Of colorful cultures, entertainment, media, life hacks, music, books and movies from hollywood & bollywood.
  • Downloads All downloads, Free and Open Source.

Download free Brajeshwar Wordpress Theme

Brajeshwar

Brajeshwar I firmly believe in keeping things simple, easy for users and I envison pushing the technical envelop time and again for the betterment of viable commercial and practical applications. More about me.

Photos

More photos on Flickr

Member of 9rules Network

Since its inception on 11th June, 2001, "Brajeshwar" has 995 Articles and 5,934 comments, contained within 17 categories and 1,639 tags.