Linux tips
Small tip, how to recreate fluxbox menu
Submitted by ggarron on Tue, 11/18/2008 - 00:30.If you like me use Fluxbox may be aware that when you install a new program it is not automatically added to the menu, yes you can always edit it manually and add the new program to fluxbox menu.
But you can also run:
fluxbox-generate_menu
Then from the old menu choose restart, and voila, you will have almost all your installed applications in the menu.
How to broadcast a message to all users - using wall -
Submitted by ggarron on Sat, 11/15/2008 - 14:01.Sometimes as the administrator of a Linux Operating System Server, y may need to send a message to all users in a multi-user system.
There are some different ways to do this, but we will now see just one of them.
We will use wall
As the main input of wall is a file, we will first create our message file.
Let's say you want to tell users that in two more ours the main SQL database is going to be unavailable because of maintenance.
So type:
Convert Youtube videos to Cell phone format
Submitted by ggarron on Thu, 10/16/2008 - 20:53.If you want to play a youtube video on your cellular you may need to convert it to the format you cell phone can actually play, I have tested this process with a Sony Ericsson K550i and it worked great, I suppose it should work on almost all modern cellphones.
Alias - create alias for your commands
Submitted by ggarron on Sat, 09/20/2008 - 15:38.Alias is a command that lets you create command aliases, it is very useful when you usually use commands with options.
As an example in my case I use a lot these commands
du -h
and
df -h
In both cases the "-h" option makes the output be in Kbytes or Mbytes instead of bytes, so it is more human redeable.
To create aliases for this commands just need to enter.
alias du='du -h'
and
alias df='df -h'
Making grub menu to wait for you -change timeout-
Submitted by ggarron on Sat, 09/20/2008 - 14:34.On my PC I have installed, Mandriva, Ubuntu, Gentoo, Sabayon and Debian (my main Linux operating system), but when I turn it on, usually I did not get the grub menu, and I am forwarded directly to Debian, sometimes I have to restart the system to start another Linux flavor.
So, the solution was to put the timeout of grub menu to 15 seconds, so I have enough time to react even when I am not paying attention to the PC startup.
The timeout parameter is stored in the file
/boot/grub/menu.lst
So, to change it edit that file with your favorite text editor. (mine is vim)
How to play a DVD video ISO image
Submitted by ggarron on Mon, 06/09/2008 - 03:47.I have this new video camera Sony that records on mini DVDs, and I got a video from my daughter dancing for the mother's day, I copied it as an image to the hard disk of my Linux Operating System machine
cat /dev/dvd/ > $HOME/video.iso
But now how to play that iso image from my disk with out using my DVD player?
These are the simple commands needed.
sudo mkdir /media/iso
To create a mount point
sudo mount -t iso9660 -o loop /home/ggarron/dvd_video.iso /media/iso
How to find files, using command line (locate)
Submitted by ggarron on Wed, 05/21/2008 - 20:27.Continuing reviewing some of my old posts, I found this one Examples of find command, now I want to show you a faster and easier way to find files.
We are going to use the commands updatedb and locate
updatedb
Which runlevel are you in?
Submitted by ggarron on Wed, 05/21/2008 - 20:06.I wrote a little runlevel explanation, now I will show you how to know in which runlevel your Linux Operating System is actually running.
Which runlevel are you in?
Enter the following command:
sudo runlevel
My output is:
N 2
Switch to other runlevel
To do that enter:
telinit [number of runlevel]
Showing line numbers on vim
Submitted by ggarron on Tue, 05/20/2008 - 13:45.Sometimes you really need to see the number of the line where you are while editing a text file, if you like vi / vim, this will help you how to turn on and off the numbering of lines.
How to find which service is listening on a given port
Submitted by ggarron on Mon, 05/19/2008 - 14:39.It is really important to know which ports are open in your PC, this is not only useful for Linux, but also for other operating systems, Linux has a lot of tools to check which ports are open, the most common is nmap which is a command line tool, but also exist a Graphical frontEnd for it if you prefer that way.
So to scan you own PC and find open ports you can enter:
sudo nmap -T Aggressive -A -v 127.0.0.1 -p 1-65000
Another way to populate your apt-cacher
Submitted by ggarron on Fri, 05/16/2008 - 21:56.If you have some Debian machines already installed, and you plan to install some others, you maybe are going to use the net-install CD, which is the most common way to install Debian.
That may take a long time, to install all the Desktop Gnome or KDE, all the applications or servers, etc, and if you have just installed your apt-cacher server as me, you will not be able to use it this first time .... unless you populate it.
wget - Resume downloads, limit the speed and much
Submitted by ggarron on Thu, 05/15/2008 - 23:09.wget is a command line tool used to download files, or complete webpages, it is a great utility with lots of options, as you can see if you read the wget man page
Some months ago, I have written about how to download files with wget, now I want to add some other tips to those already explained that day.
Resume a download
The /etc/default/rcS file
Submitted by ggarron on Thu, 05/15/2008 - 19:40.There is some behavior of your Linux Operating System which is easy to change, but not too common to know how.
The things you can change are:
- Frequency to erase /tmp/ directory
- Use UTC or local time
- How Verbose are the boot messages of your Linux
- If a disk error should be always repaired while booting automatically
There are more than those, but I will touch only those, for the rest, you can enter:
man /etc/default/rcS
Tip: Importing your /var/cache/apt/ files to apt-cacher database
Submitted by ggarron on Thu, 05/15/2008 - 14:46.Yesterday, I wrote about apt-cacher, and when you first install it, its database is empty, and of course the server where it is installed could have a lot of .deb files, in the /var/log/apt/archives/, so it would be great to use those packages in our new ATP proxy.
To do that we need one of the perl scripts that come with apt-cacher, and that are stored in:
/usr/share/apt-cacher
The right script for this task is: apt-cacher-import.pl , so run:
Cut or trim mp3 files with Linux, mpgsplit and mp3cut
Submitted by ggarron on Mon, 05/12/2008 - 20:51.Some months ago I have posted an article showing how to use audacity to edit mp3 files with Linux, this time it is almost the same but we will use our Linux Operating system command line to do that.
We are going to see two different options:
1. mpgtx
To install this program under Debian
sudo aptitude install mpgtx
Now if you want to trim a mp3 file into 10 pieces just enter this command
mpgtx -10 input.mp3 -o output
Small tip, how to install startx command
Submitted by ggarron on Mon, 04/28/2008 - 14:44.Today, I was "playing" with the Linux configuration (as usually) and using tasksel on my Debian I remove the Desktop section, and installed it again, when I tried to use startx I just could not, there was no startx command.
After reading a while I found that I needed to install xinit package to have startx in my machine.
so:
sudo aptitude install xinit
cpufreqd - How to configure you cpu speed
Submitted by ggarron on Sun, 04/13/2008 - 06:21.cpufreqd is a Linux daemon, that lets you control the speed of your CPU(s), depending on some variables, or also be set manually, you can set it to act dynamically or manually, you can define a lot of profiles and rules, which will control your CPU speed, the variables could be the temperature of your CPU, the amount of charge in your battery if AC is connected or not.
First thing you need to do is to install the daemon, in Debian / Ubuntu
sudo aptitude install cpufreqd
Problems using OpenOffice documents on a NFS drive
Submitted by ggarron on Mon, 04/07/2008 - 18:05.I am using OpenOffice 2.3 with Debian Lenny, and using a drive over NFS and OpenOffice seems to fail locking the file, so it "hangs" for a while and suddenly comes to life again but the file opened is only in read mode.
First I went to check my /etc/exports file and then to check if everything in the /etc/hosts.deny and /etc/hosts.allow files and all was correct, so after googling a while I found the solution.
You need to change the file:
/usr/bin/soffice
and make these lines look this way:
Trash can or Recycle bin in Linux Desktop (managed from console)
Submitted by ggarron on Fri, 04/04/2008 - 20:21.Linux Desktops, at least Gnome and KDE has a trash can, where your deleted files go, (only when deleted from a Desktop utility).
Now if you want to manage it from the console, you can, first we need to know that the trash can is only another folder in the File system structure and it is located at:
$HOME/.Trash
so you can send files to Trash just moving them to there, as an example, lets suppose you have a file in your home called balance.ods and want to move it to the trash can.
mv $HOME/balance.ods $HOME/.Trash/
How to assign a password to root user in Ubuntu
Submitted by ggarron on Wed, 04/02/2008 - 11:41.Ubuntu by default has no root password, and you can also configure Debian in that way if you choose the advanced installation option, and decide not to use the root password.
But what to do if later you need the root user? well you just need to assign a password to the root user and then you will be able to switch to root user.
sudo passwd
Type a good strong password twice, and you are done.
su -
Type the root password and voila! you are logged as root, you know you have to be carefull on what you do being root right?



