Showing posts with label FREE/OPEN-SOURCE. Show all posts
Showing posts with label FREE/OPEN-SOURCE. Show all posts

Tuesday, July 10, 2012

Overcoming the Fear of Linux Terminal


Fear is a painful emotion by the expectation of evil, or the apprehension of impending danger; anxiety; solicitude; alarm; dread; like our fear of ghosts and zombies as a child, and our fear of failure and death as an adult. I’m here to help Linux newbies defeat their fear, but not the kind of fear that I was talking about. Instead, I’m here to assist those who are suffering from CLI-phobia, or the “fear of Command Line Interface”. I will list some indispensable commands and keyboard shortcuts with their corresponding functions to guide the fearful in their journey to conquer the horror of using the Linux terminal.
Here are some of the most essential Linux terminal commands andkeyboard shortcuts:

*Essential Commands
Commands - Functions
Directory navigation
Pwd - "Print working directory" - show what dir you're in.
ls - List the contents of a dir.
ls –l - List the contents of a dir and show additional info of the files.
ls –a - List all files, including hidden files.
cd - Change directory.
cd - Go to the parent directory.
Examining files
file - Determine the type of a file.
cat - Concatenate a file.
less - View text files and paginate them if needed.
Manipulating files and directories
p - Copy a file.
cp –i - Copy a file and ask before overwriting.
cp –r - Copy a directory with its contents.
mv - Move or rename a file.
mv –i - Move or rename a file and ask before overwriting.
rm - Remove a file.
rm –r - Remove a directory with its contents.
rm –i - Ask before removing a file. Good to use with the -r option.
mkdir - Make a directory.
rmdir - Remove an empty directory.

*Essential Keyboard Shortcuts
Ctrl + Alt + F1
Switch to the first virtual terminal. In Linux, you can have several virtual terminals at the same time. The default is 6.

Ctrl + Alt + Fn
Switch to the nth virtual terminal. Because the number of virtual terminals is 6 by default, n = 1...6.

tty
Typing the tty command tells you what virtual terminal you're currently working in.

Ctrl + Alt + F7
Switch to the GUI. If you have X Window System running, it runs in the seventh virtual terminal by default. If X isn't running, this terminal is empty.

Ctrl + Alt + +
Switch to the next resolution in the X Window System. This works if you've configured more than one resolution for your X server. Note that you must use the + in your numpad.

Ctrl + Alt + -
Switch to the previous X resolution. Use the - in your numpad.

MiddleMouseButton
Paste the highlighted text. You can highlight the text with your left mouse button (or with some other highlighting method, depending on the application you're using), and then press the middle mouse button to paste. This is the traditional way of copying and pasting in the X Window System, but it may not work in some X applications.

If you have a two-button mouse, pressing both of the buttons at the same time has the same effect as pressing the middle one. If it doesn't, you must enable 3-mouse-button emulation.

This works also in text terminals if you enable the gpm service.

Ctrl + Alt + Backspace
Kill the X server. Use this if X crashes and you can't exit it normally. If you've configured your X Window System to start automatically at bootup, this restarts the server and throws you back to the graphical login screen.

Home or Ctrl + a
Move the cursor to the beginning of the current line.

End or Ctrl + e
Move the cursor to the end of the current line.

Alt + b
Move the cursor to the beginning of the current or previous word. Note that while this works in virtual terminals, it may not work in all graphical terminal emulators, because many graphical applications already use this as a menu shortcut by default.

Alt + f
Move the cursor to the end of the next word. Again, like with all shortcuts that use Alt as the modifier, this may not work in all graphical terminal emulators.

Tab
Autocomplete commands and file names. Type the first letter(s) of a command, directory or file name, press Tab and the rest is completed automatically! If there are more commands starting with the same letters, the shell completes as much as it can and beeps. If you then press Tab again, it shows you all the alternatives.

This shortcut is really helpful and saves a lot of typing! It even works at the lilo prompt and in some X applications.

Ctrl + u
Erase the current line.

Ctrl + k
Delete the line from the position of the cursor to the end of the line.

Ctrl + w
Delete the word before the cursor.

Shift + PageUp
Scroll terminal output up.

Shift + PageDown
Scroll terminal output down.

clear
The clear command clears all previously executed commands and their output from the current terminal.

Ctrl + l
Does exactly the same as typing the clear command.

reset
If you mess up your terminal, use the reset command. For example, if you try to cat a binary file, the terminal starts showing weird characters. Note that you may not be able to see the command when you're typing it.

history
When you type the history command, you'll see a list of the commands you executed previously.

ArrowUp or Ctrl + p
Scroll up in the history and edit the previously executed commands. To execute them, press Enter like you normally do.

ArrowDown or Ctrl + n
Scroll down in the history and edit the next commands.

Ctrl + r
Find the last command that contained the letters you're typing. For example, if you want to find out the last action you did to a file called "file42.txt", you'll press Ctrl + r and start typing the file name. Or, if you want to find out the last parameters you gave to the "cp" command, you'll press Ctrl + r and type in "cp".

Ctrl + c
Kill the current process.

Ctrl + z
Send the current process to background. This is useful if you have a program running, and you need the terminal for awhile but don't want to exit the program completely. Then just send it to background with Ctrl+z, do whatever you want, and type the command fg to get the process back.

Ctrl + d
Log out from the current terminal. If you use this in a terminal emulator under X, this usually shuts down the terminal emulator after logging you out.

Ctrl + Alt + Del
Reboot the system. You can change this behavior by editing /etc/inittab if you want the system to shut down instead of rebooting.
Other Essential CLI Related Help Sites:
http://www.er.uqam.ca/nobel/r10735/unixcomm.html
http://www.computerhope.com/unix.htm
http://www.tuxfiles.org/
http://www.freesoftwaremagazine.com/articles/command_line_intro
http://linux.about.com/od/linux101/l/blnewbie5_1.htm

"Fear is the main source of superstition, and one of the main sources of cruelty. To conquer fear is the beginning of wisdom."
Bertrand Russell (1872 - 1970), Unpopular Essays (1950), "Outline of Intellectual Rubbish"

Happy Halloween!

You may also want to check out our list of Linux terminal emulators.

8 Best Linux Terminal Emulators You May Have Never Heard Of


8 Best Linux Terminal Emulators You May Have Never Heard Of: For some Linux users, the terminal or command line shell is a useful and powerful tool that can help accomplish tasks (from simple to complex) in a more efficient and often quicker way. Although it is not a necessity anymore, I think it would still be handy to have some basic command line skills. To those of you who are afraid to use the Linux terminal, perhaps you should get or download some Linux/UNIX command cheat sheets.

Since majority of popular Linux distributions utilizes either KDE or GNOME desktop environment, you may have only used terminal emulators such as Konsole, GNOME Terminal, and xterm. But did you know that there are capable and unique terminal emulators for Linux other than those I've mentioned?

Here is a list of some of the best Linux terminal emulators you may have never heard of (in no particular order):


Terminator
Terminator is currently my favorite Linux terminal emulator. It allows me to easily organize multiple command line sessions into resizable split panes within the same window. This way, I can do some command-line multitasking in a more efficient manner, minus the desktop clutter. Terminator is written in Python, and it will work on any modern POSIX system with Java 5 or later, which means it can also run on other operating system platforms aside from Linux such as Windows and Mac OS X.



Guake
Guake is a top-down terminal emulator for GNOME Desktop Environment that has a design inspired by consoles in computer games such as Quake and Doom. It can quickly slide down from the top of the screen using a single keystroke, and can be hidden by pressing the same key. The advantage of using Guake when compared to the standard terminal is that it is faster to open since the program is already loaded into the computer memory.



Yakuake
Yakuake (Yet Another Kuake) is a drop-down KDE terminal emulator with features almost similar to that of Guake. Its design was also inspired by consoles in computer games. Like Kate, Konqueror, and other KDE applications, Yakuake depends on Konsole for its terminal functionality.



rxvt
rxvt is a simple and lightweight terminal emulator that is aimed to be a slimmed-down replacement for the already slim xterm, removing several of its little-used features, like Tektronix 4014 emulation and toolkit-style configurability. Apart from features like those controlled by resource files, the terminal emulation of rxvt differs from xterm in a few important ways.



Tilda
Tilda is a slide-down GTK+ terminal emulator similar to that of Guake and Yakuake. The program also runs invisibly in the background allowing it to quickly slide up and down once a hotkey is pressed.



mrxvt
mrxvt is a multi-tabbed terminal emulator based on rxvt that provides DEC VT102 compatible terminals. Like rxvt, it is fast, lightweight, and flexible without depending on desktop environments such as GNOME or KDE. The main features of mrxvt include multiple tabs, dynamically changeable tab titles, customizable command for each tab, input broadcasting, fast pseudo-transparency with tinting, user supplied background images, multi-language support, Freetype font, logging, and more.



Wterm
Wterm is a fork rxvt that is also very fast and lightweight. Its look was designed for NeXTSTEP style window managers like Window Maker. It has terminal support for Latin, Chinese, and Greek characters and features customizable background images, background color tinting, and zero overhead pseudo-transparent background.



aterm
aterm is the AfterStep terminal emulator for the X Window System that is based (again) on rxvt. As described from its project webpage, aterm is designed to provide pleasing visual effects, while performing such a mundane function as terminal emulation under X.



If you know of other capable terminal emulators for Linux that I fail to include on the above list, please share them with us via comment.

10 Essential UNIX/Linux Command Cheat Sheets


Linux has become so idiot proof nowadays that there is less and less need to use the command line. However, the commands and shell scripts have remained powerful for advanced users to utilize to help them do complicated tasks quickly and efficiently.

To those of you who are aspiring to become a UNIX/Linux guru, you have to know loads of commands and learn how to effectively use them. But there is really no need to memorize everything since there are plenty of cheat sheets available on the web and on books. To spare you from the hassles of searching, I have here a collection of 10 essential UNIX/Linux cheat sheets that can greatly help you on your quest for mastery:

UNIX Tutorial for Beginners
This is a quick and easy UNIX/Linux tutorial page that is aimed at beginners. It gives a subtle introduction to some of the most important UNIX/Linux commands.


Learning the Shell
Aside from showing you how to apply the most basic UNIX/Linux commands, “Learning the Shell’ will teach you the utmost importance of using the command line.


Learn UNIX in 10 Minutes
From the page: This is something that I had given out to students (CAD user training) in years past. The purpose was to have on one page the basics commands for getting started using the UNIX shell (so that they didn't call me asking what to do the first time someone gave them a tape).


FOSSwire Unix/Linux Command Cheat Sheet
A one page UNIX/Linux command reference that you can download in PDF format. You can easily print it, and then paste it on your wall.

UNIX Toolbox
From the page: This document is a collection of Unix/Linux/BSD commands and tasks which are useful for IT work or for advanced users. This is a practical guide with concise explanations; however the reader is supposed to know what s/he is doing.


Practical Linux Command Line Reference
This is another handy one-page cheat sheet for common command line operations. All of the commands have been tested on Fedora and Ubuntu.


How to Look Like a UNIX Guru
From the page: This lecture takes you through the basic commands and then shows you how to combine them in simple patterns or idioms to provide sophisticated functionality like histogramming. This lecture assumes you know what a shell is and that you have some basic familiarity with UNIX.



A Directory of Linux Commands (in alphabetical order)
From the O'reilly book “Linux in a Nutshell, 5th Edition”, it features an alphabetical list of 687 commands and a short description on each one of them.

Linux Security Quick Reference Guide
This quick reference guide (in PDF) will serve as your aid on improving the security of your Linux system. It provides some pointers to more in-depth security information that could help you become a good UNIX/Linux system administrator.


Bash Programming Cheat Sheet
From the page: A quick cheat sheet for programmers who want to do shell scripting. This is not intended to teach programming, etc. but it is intended for someone who knows one programming language to begin learning about bash scripting.


Through comments, feel free to share some links to other essential UNIX/Linux cheat sheets that I failed to include here.

Monday, June 25, 2012

3 Ways to Automate Tasks on Linux


Linux is, and always was, one of the most powerful operating systems on the planet. From Android to Ubuntu, Linux’s versatility has made it quite popular with developers, system admins, hackers, and of course, end users. Though simple to use and learn, Linux’s untapped prowess can be used to accomplish many tasks in your daily life. From running a garden sprinkler to rocking a baby’s cradle, Linux is just about as awesome as Chuck Norris.

Don’t worry if you are not that adventurous, because the penguin can also help you save the time you spend on simple repetitive tasks by automating them. Tasks like backing up your important folders, rebooting your computer, and even downloading torrents. So, whether you’re a little lazy (as all geeks are) or just someone who doesn't have much time, this article will guide you in saving a few precious hours in your life by automating boring repetitive tasks for you.


Take Automatic Backups
If you’re worried about losing your data, then backing it up safely is the best solution. We've already listed some of the best backup tools for Linux; however, the shining newDeja Dup is our favorite these days. Its simplicity as well as its inclusion as the default backup application in Ubuntu has made it a reliable choice. Deja Dup, once set up, can allow you to take automatic backups of your data without you having to manually do it. To get started, simply open Deja Dup by searching for it using the launcher (Super key).

Now, once the application starts, go to the “schedule” tab and select the frequency that suits you best. Also, don’t forget to choose whether to keep backups forever or for a set period of time. You don’t want to have your hard disk or online account bloated with just backups.

Then, once you are set, go back to the ‘Overview’ tab and turn ‘Automatic Backups’ on. This will ensure that your data is safe even when you’re not using the computer. Of course, you’ll have to leave your computer on for this.


Reboot or Shutdown your computer
Using the ‘at’ command you can shutdown or reboot your Linux device even while you’re away from it. So, let’s say you want to shutdown your computer at 3 PM. To get started, open the terminal first (Ctrl + Alt + T), then punch in the following command:

at 3pm
Now, the command will take you to a prompt mode wherein you’ll instruct ‘at’ to do a particular job. There, simply enter the command ‘halt’ without quotes. Press Ctrl+D to exit.

Now, you've instructed the computer to halt (that is to shut down) at 3pm. You can, in the same way, add more commands to the list. To check on the current pending jobs, simply enter the ‘atq’ command without quotes. To remove a particular job, use the ‘atrm’ command.


Auto-start torrent downloads
If you’re sleeping or out of the house and wanted to auto-start a download at a specific time, then Linux can be your best friend. Say, you’re leaving your house at 10 AM, you can then schedule Linux to start Transmission (popular torrent client) at 2 PM using the following command.

sleep 4h && transmission-gtk
The above command will start Transmission exactly 4 hours after you've issued it. If you want Transmission to run after 3 and a half hours, simply enter this command:

sleep 3h && sleep 30m && transmission-gtk
This can be very useful for people who use data plans where in the ISPs provide unlimited downloading at night. Also, if you want to stop the download before you wake up, or at a specific time, you can issue the following command:

sleep 8h && pkill transmission-gtk