Showing posts with label guideline. Show all posts
Showing posts with label guideline. Show all posts

The 10 most useful Linux commands

Maybe the command line isn’t your favorite place to hang out, but to be an effective Linux admin, you need to be able to wield a few essential commands. Jack Wallen says these 10 are guaranteed to simplify your Linux admin life — and he explains why.


I understand that many of you don’t want to use the command line in Linux (or in any operating system, for that matter). But the truth is, to be a good administrator, you have to know the command line. Why? Well, with Windows there are times when the command line is the only thing that can save your skin. With Linux, the command line is vast, reliable, flexible, fast… I could go on and on.
And of the 2,119 possible commands from the /usr/bin directory (in Mandriva Spring 2008) and the 388 possible commands from /usr/sbin/, a few are indispensable. Here are 10 of them that might make your Linux admin life — or your introduction to Linux — a whole lot simpler.
I could make this easy and go with the most used commands (cd, ls, rm, etc — okay, etc isn’t a command, but you get the point). But instead, I am going to go with the most useful commands, and I’ll keep it as distribution-neutral as I can.

#1: top
I figured it was fitting to put the top command at the top. Although top is actually responsible for listing currently running tasks, it is also the first command Linux users turn to when they need to know what is using their memory (or even how much memory a system has). I often leave the top tool running on my desktop so I can keep track of what is going on at all times. Sometimes, I will even open up a terminal (usually aterm), place the window where I want it, and then hide the border of the window. Without a border, the terminal can’t be moved, so I always have quick access to the information I need.
Top is a real-time reporting system, so as a process changes, it will immediately be reflected in the terminal window. Top does have some helpful arguments (such as the -p argument, which will have top monitor only user-specified PIDs), but running default, top will give you all the information you need on running tasks.

#2: ln
To many administrators, links are an invaluable tool that not only make users lives simpler but also drastically reduce disk space usage. If you are unaware of how links can help you, let me pose this simple scenario: You have a number of users who have to access a large directory (filled with large files) on a drive throughout the day. The users are all on the same system, and you don’t want to have to copy the entire directory to each user’s ~/ directory. Instead, just create a link in each user’s ~/ directory to the target. You won’t consume space, and the users will have quick access. Of course when spanning drives, you will have to use symlinks. Another outstanding use for links is linking various directories to the Apache doc root directory. Not only can this save space, it’s often advantageous from a security standpoint.

#3: tar/zip/gzip
Tar, zip, and gzip are archival/compression tools that make your administrator life far easier. I bundle these together because the tools can handle similar tasks yet do so with distinct differences (just not different enough to warrant their own entry in this article). Without these tools, installing from source would be less than easy. Without tar/zip/gzip, creating backups would require more space than you might often have.
One of the least used (but often most handy) features of these tools is the ability to extract single files from an archive. Now zip and gzip handle this more easily than tar. With tar, to extract a single file, you have to know the exact size of the file to be extracted. One area where tar/zip/gzip make administration simple is in creating shells scripts that automate a backup process. All three tools can be used with shell scripts and are, hands down, the best, most reliable backup tools you will find.

#4: nano, vi, emacs
I wasn’t about to place just one text editor here, for fear of stoking the fires of the “vi vs. emacs” war. To top that off, I figured it was best to throw my favorite editor — nano — into the mix. Many people would argue that these aren’t so much commands as they are full-blown applications. But all these tools are used within the command line, so I call them “commands.” Without a good text editor, administering a Linux machine can become problematic.
Imagine having to attempt to edit /etc/fstab or /etc/samba/smb.conf with OpenOffice. Some might say this shouldn’t be a problem, but OpenOffice tends to add hidden end-of-line characters to text files, which can really fubar a configuration file. For the editing of configuration or bash files, the only way to go is with an editor such as nano, vi, or emacs.

#5: grep
Many people overlook this amazingly useful tool. Grep prints lines that match a user-specified pattern. Say, for instance, that you are looking at an httpd.conf file that’s more than 1,000 lines long, and you are searching for the “AccessFileName .htaccess” entry. You could comb through that file only to come across the entry at line 429, or you can issue the command grep -n “AccessFileName .htaccess” /etc/httpd/conf/http.conf. Upon issuing this command you will be returned “439:AccessFileName .htaccess” which tells you the entry you are looking for is on, surprise of all surprises, line 439.
The grep command is also useful for piping other commands to. An example of this is using grep with the ps command (which takes a snapshot of current running processes.) Suppose you want to know the PID of the currently crashed Firefox browser. You could issue ps aux and search through the entire output for the Firefox entry. Or you could issue the command ps aux|grep firefox,at which point you might see something like this:

jlwallen 17475 0.0 0.1 3604 1180 ? Ss 10:54 0:00 /bin/sh /home/jwallen/firefox/firefoxjlwallen 17478 0.0 0.1 3660 1276 ? S 10:54 0:00 /bin/sh /home/jlwallen/firefox/run-mozilla.sh /home/jlwallen/firefox/firefox-bin

jlwallen 17484 11.0 10.7 227504 97104 ? Sl 10:54 11:50 /home/jlwallenfirefox/firefox-bin

jlwallen 17987 0.0 0.0 3112 736 pts/0 R+ 12:42 0:00 grep --color firefox
Now you know the PIDs of every Firefox command running.

#6: chmod
Permissions anyone? Linux administration and security would be a tough job without the help of chmod. Imagine not being able to make a shell script executable with chmod u+x filename. Of course it’s not just about making a file executable. Many Web tools require certain permissions before they will even install. To this end, the command chmod -R 666 DIRECTORY/ is one very misused command. Many new users, when faced with permissions issues trying to install an application, will jump immediately to 666 instead of figuring out exactly what permissions a directory or folder should have.
Even though this tool is critical for administration, it should be studied before jumping in blindly. Make sure you understand the ins and outs of chmod before using it at will. Remember w=write, r=read, and x=execute. Also remember UGO or User, Group, and Other. UGO is a simple way to remember which permissions belong to whom. So permission rw- rw- rw- means User, Group, and Other all have read and write permissions. It is always best to keep Other highly restricted in their permissions.

#7: dmesg
Call me old-school if you want, but any time I plug a device into a Linux machine, the first thing I do is run the dmesg command. This command displays the messages from the kernel buffer. So, yeah, this is an important one. There is a lot of information to be garnered from the dmesg command. You can find out system architecture, gpu, network device, kernel boot options used, RAM totals, etc.
A nice trick is to pipe dmesg to tail to watch any message that comes to dmesg. To do this, issue the command dmesg | tail -f and the last few lines of dmesg will remain in your terminal. Every time a new entry arrives it will be at the bottom of the “tail.” Keep this window open when doing heavy duty system administration or debugging a system.

#8: kill/killall
One of the greatest benefits of Linux is its stability. But that stability doesn’t always apply to applications outside the kernel. Some applications can actually lock up. And when they do, you want to be able to get rid of them. The quickest way to get rid of locked up applications is with the kill/killall command. The difference between the two commands is that kill requires the PID (process ID number) and killall requires only the executable name.
Let’s say Firefox has locked up. To kill it with the kill command you would first need to locate the PID using the command ps aux|grep firefox command. Once you got the PID, you would issue kill PID (Where PID is the actual PID number). If you didn’t want to go through finding out the PID, you could issue the command killall firefox (although in some instances it will require killall firefox-bin). Of course, kill/killall do not apply (nor should apply) to daemons like Apache, Samba, etc.

#9: man
How many times have you seen “RTFM”? Many would say that acronym stands for “Read the Fine* Manual” (*This word is open for variation not suitable for publication.) In my opinion, it stands for “Read the Fine Manpage.” Manpages are there for a reason — to help you understand how to use a command. Manpages are generally written with the same format, so once you gain an understanding of the format, you will be able to read (and understand) them all. And don’t underestimate the value of the manpage. Even if you can’t completely grasp the information given, you can always scroll down to find out what each command argument does. And the best part of using manpages is that when someone says “RTFM” you can say I have “RTFMd.”

#10: mount/umount
Without these two commands, using removable media or adding external drives wouldn’t happen. The mount/umount command is used to mount a drive (often labeled like /dev/sda) to a directory in the Linux file structure. Both mount and umount take advantage of the /etc/fstab file, which makes using mount/umount much easier. For instance, if there is an entry in the /etc/fstab file for /dev/sda1 that maps it to /data, that drive can be mounted with the command mount /data. Typically mount/umount must have root privileges (unless fstab has an entry allowing standard users to mount and unmount the device). You can also issue the mount command without arguments and you will see all drives that are currently mounted and where they’re mapped to (as well as the type of file system and the permissions).

Can’t live without ‘em
These 10 Linux commands make Linux administration possible. There are other helpful commands, as well as commands that are used a lot more often than these. But the commands outlined here fall into the necessity category. I don’t know about you, but I don’t go a day without using at least half of them. Do you have a Linux command or two that you can’t live without? If so, let us know.

System monitoring with Conky

My number one favorite system monitor used to be Gkrellm, a small GUI tool that displays system information such as CPU usage, memory and hard drive usage, network throughput, and so forth. Recently, I discovered Conky, which is another system monitoring tool that works extremely well. One of the nice advantages to Conky is that it can operate in a window-less mode, so it persistently anchors to the desktop, preventing it from being moved or closed.

On many distributions, it’s a yum or apt-get away; on Fedora 11, you would simply execute the following to install it:

# yum install conky


Once installed, copy the default configuration file (usually /etc/conky/conky.conf) to ~/.conkyrc so you may begin to customize it to suit your tastes and display the information you choose.
By default it displays the uptime, system CPU operating frequency, the number of running processes, the usage for RAM, swap, and CPU, hard drive space used, networking throughput, and the top four CPU-consuming processes.
A few nice tweaks to the defaults include setting the following options in ~/.conkyrc:

double_buffer yes
own_window_transparent yes
xftfont DejaVu Sans Mono:size=10
The first is useful if you experience window flickering in Conky as it refreshes status information; usually setting double_buffer will correct this issue. The second makes Conky transparent, so it looks as though the statistics are part of the desktop itself. Finally, changing the xftfont string can provide different fonts and smaller font sizes (the default is to use a 12pt size; setting it to 10 makes it take up less room on the desktop and is still quite readable).
The configuration file has a lot that can be added to it, allowing you to monitor many parts of your system. It can monitor POP3/IMAP mail accounts, temperature, the number of connections on specified TCP ports, fan states, battery charge, and much more. The full variable listing of what Conky supports is available on the Web site. As an example, you can make Conky monitor the number of SSH connections to the system and to display the system load average like this:

${color yellow}Load Average:$color $loadavg
${color grey}SSH connections:$color ${tcp_portmon 22 22 count}
The first displays the “Load Average” text in yellow, and then displays the load average. The second displays the number of connections on port 22. The “count” option can be replaced with others, some of which are “rip” to display the remote IP address and “rhost” to display the remote hostname.
The configuration is quite versatile and there is a lot you can monitor with Conky. Having Conky run when you login as a startup item will have it constantly available on the desktop. It also is not bound to a virtual desktop, so it is available on all of them, and does not take up any room on the panel as an active process. Finally, any users of GeekTool on OS X will find that the feel of Conky is quite similar to that versatile tool.

Transfer songs videos playlists from iPod to iPhone easily

Step 1: Free download this iPod to iPhone transfer and run it.

Step 2: Launch this iPod to iPhone transfer. The interface is as follows:

Transfer songs videos playlists from iPod to iPhone

Step 3: Connect two iPods to your computer. Then your iPods' information will be displayed:

Transfer songs videos playlists from iPod to iPhone

Note: The two windows will display the same iPod's info. Just click the other tab:

Transfer songs videos playlists from iPod to iPhone

Transfer songs videos playlists from iPod to iPhone

Step 4: Creat a playlist on one iPod (you want to transfer songs to):

Click playlist button:

Transfer songs videos playlists from iPod to iPhone

Then double-click Add New Playlist:

Transfer songs videos playlists from iPod to iPhone

Transfer songs videos playlists from iPod to iPhone

The added playlist will be displayed:

Transfer songs videos playlists from iPod to iPhone

Step 5: Highlight the file(s) you'd like to transfer to the new playlist::

Transfer songs videos playlists from iPod to iPhone

Step 6: Click <- arrow to transfer selected files to the new created playlist:

Transfer songs videos playlists from iPod to iPhone

Then the file counts will change to 1:

Transfer songs videos playlists from iPod to iPhone

Done! Now you have successfully transfered songs/videos/palylists from iPod to iPhone. Enjoy the music from other iPod on your iPhone right now!

Get music videos playlists from iPod Nano to iPod Touch

iPod 2 iPod is the best and powerful iPod transfer capability. It can copy music/video/playlist from iPod Nano to iPod Touch by Drag and Drop. iPod 2 iPod will transfer music/video/playlist from one to one at extremely fast speed. It supports the latest iPod Nano to iPod Touch transfer.

Guide: How to get music videos playlists from iPod Nano to iPod Touch?

Step 1: Free download this iPod to iPod Touch transfer and run it.

Step 2: Launch this iPod to iPod Touch transfer.

Step 3: Connect two iPods to your computer. Then your iPods' information will be displayed:



Note: The two windows will display the same iPod's info. Just click the other tab:




Step 4: Creat a playlist on one iPod (you want to transfer songs to):

Click playlist button:



Then double-click Add New Playlist:



The added playlist will be displayed.


Step 5: Highlight the file(s) you'd like to transfer to the new playlist.


Step 6: Click <- arrow to transfer selected files to the new created playlist:


Then the file counts will change to 1:



Done! Now you have successfully transfered songs/videos/palylists from iPod Nano to iPod Touch. Enjoy the music from other iPod on your iPod right now!

Guides for convert DVD to YouTube video formats


Step 1
Insert the DVD disk into the DVD drive, open the program and import the DVD files.


Step 2
Do the settings:
1. In Subtitle, select the subtitle language.
2. In Audio, select the language of the audio.
3. In Profile, select WMV Video.
4. In Output, set your destination folder for the output file.



Step 3
Click "Customize" to customize the video in your desire.
a. Effect adjustment:
Drag the slides for Brightness, Contrast, and Volume to improve the video quality.



b. Drag the buttons on the slide to trim the video or change the values directly in the Start Time and End Time.
c. Choose a selection from "Letter Box" to crop the video, or directly drag the dot frame for it. Click "OK" to confirm the settings.

Step 4
Click the big button to start the conversion.



How to upload the converted video onto YouTube?
1. Go to the website YouTube.com
2. Create an account if you have not already have one. Or go onto the next step if you already have an account.
3. Log into your account.
Click the yellow "Upload" button on the top right-hand side of the homepage.
4. Enter the details required, the title of the video, the description of the video, what category the video should be in and the tags. Optionally, you can fill in the 'Broadcast Options', the 'Date and Map Options' and the 'Sharing Options'.
5. Click "Continue".
6. Choose a video file. Remember only certain video formats can be uploaded to YouTube so make sure you have the right type of file.
7. Finally click "Upload Video" and wait for your video to complete processing.

Solve Start-up Error Messages

Reader Randy is suffering from a vexing problem. Each time he boots his PC, he gets a pop-up Internet Explorer window with this message:
"Cannot find 'File:///'. Make sure the path or internet address is correct."

I feel you, Randy. Stuff like this can be seriously annoying. My guess is that you recently installed or uninstalled a program that Windows is looking for--but can't find--during startup.

What you need is some kind of startup monitor that will show you everything that's trying to run during the boot process, so you can determine which Internet Explorer-related item is the offender--and then disable it.

If you're reasonably tech-savvy, I recommend Autoruns, a free utility hosted on Microsoft's TechNet site.

After running it, click the Logon tab and look for any entries that point to iexplore.exe. If you find one, clear its checkbox and reboot. Obviously this may involve a little trial and error, but it should ultimately solve the problem.



A similar, but simpler, approach is to run Windows' msconfig utility, click the Startup tab, and then peruse the Command column (which you may have to enlarge for full visibility) for entries containing iexplore.exe. If you find one, clear its checkbox, click OK, and then reboot.

Hope that does the trick!