Thursday, November 17, 2022

Linux Tips and Tricks

 

Helpful Tips and Tricks for Linuxbies

Disclaimer : I came upon these tips and tricks on the Internet searching for solutions to the problems i came across over the course of almost three years of using Linux. Some of these have been copied from the Internet for my sole use. I compiled this document for my own convenience and I dont take responsibility for any harm done to your computer or settings by using any of the tricks below.. So, use at your own risk.

Add files to Totem playing list from Nautilus

just use nautilus-actions-config and use the following settings:

Label: Tooltip: Add to totem playlist

Icon: /usr/share/pixmaps/totem.xpm

Action: totem

Parameters: –enqueue %M

Appears if file matches filenames: *.mp3 ; *.ogg ; *.mpc ; *.aac ; *.wav ;

*.ac3 ; *.avi ; *.ogm ; *.mpg ; *.mpeg ; *.wmv ; *.rm ; *.ram ; *.vob ; *.asf

Appears if selection contains: only files

Appears for multiple: true

Package search from terminal(command line)

apt-cache search packagename

eg. If you want to serach for a package named similar to sysinfo then type 'apt-cache search sysinfo' into terminal.

Use Audacious Skins

Download some skins of Winamp, extract it and copy it to "/usr/share/audacious/skins/" (not "~/.audacious/Skins" which is popular on the Internet). Remember that you should use "sudo".

sudo nautilus /usr/share/audacious/skins/

Then I change it to the active skin in the "preference" of Audacious

Autostart in KDE

KDE for all its eye candy and general slickness really sucks on some basic points. One of these is with auto-starting programs upon login. Suggestions to get this working almost always involve having the use the command-line or following a prolonged series of steps for a task which should ideally involve no more than a few clicks. Usually, most people suggest the following as a solution even to newbies:

Open up Konqueror. Navigate to your home folder.

Click on View. Select Show Hidden Files.

Look for a folder named .kde and open it.

Look for a folder named Autostart and open it.

Right click inside Konqueror. Select Create New and Text File.

Give the text file the name of the program you would like to autostart.

Open the file using Kate or the text editor of your choice.

Type #!/bin/bash on the first line.

Type the command to launch your program along with any necessary switches.

Save the file.

Right click on the file, select Properties and the Permissions tab.

Finally, check the is executable box and click OK to complete the process.

Are you fucking kidding me? I know that user-friendly Linux is still something of an oxymoron. However, this is really pushing it. Convinced that there had to be a better solution, I decided to google some more and eventually found that the recommended procedure is actually the following:

Open up Konqueror. Navigate to your home folder.

Click on View. Select Show Hidden Files.

Look for a folder named .kde and open it.

Look for a folder named Autostart and open it.

Click on the K Menu icon and navigate to the program that you would like to auto-start.

Drag the icon for said program into the Konqueror window and select Copy Here when prompted.

And that's it! No text editors. No jargon. No code. If you bookmark the Autostart folder, then it becomes an even easier process very similar to that in Windoze. That said, the whole idea of placing the Autostart folder inside a hidden folder smacks of idiocy.

Switch between GDM and KDM

When you have Gnome and KDE both installed on the Ubuntu, you may need to switch between the window managers gdm and kdm. Here's how you do it from terminal.

sudo dpkg-reconfigure gdm or sudo dpkg-reconfigure kdm

Activate Hidden Icons in Ubuntu(Gnome)

Give Me My Trash Can!

The developers who designed Ubuntu’s desktop decided to keep the desktop largely clean of icons. This included relegating the Trash icon to its own applet at the bottom-right side of the screen. Many people find using the applet a little difficult and miss the desktop trash can icon, which has been present on Windows and Mac OS desktops for more than 20 years.

The good news is that it’s easy to get the trash can back. Click Applications -> Accessories -> Terminal, and at the command prompt type gconf-editor. In the program window that appears, click the down arrows next to Apps, then Nautilus (you’ll have to scroll down the list a little), and then click Desktop. On the right side of the program window, put a check in the trash_icon_visible entry. The Trash icon should then instantly appear on your desktop! To delete the old Trash icon at the bottom right, simply right-click it and select Remove from Panel.

You can also put a check in the computer_icon_visible, home_icon_visible, and documents_icon_visible entries if you wish to see Computer, Home, and Documents desktop icons. By putting a check alongside network_icon_visible, you can add a My Network Places–style icon to the desktop too.

Be careful when using the Configuration Editor program. It lets you configure just about every aspect of the GNOME desktop and doesn’t warn you when you’re about to do something devastating, so the potential for accidental damage is high.

Enqueue in Audacious in KDE

Open a mp3 file's properties->edit file type->select audacious->click edit->paste the following : -

audacious --enqueue "${FILE}"

EOL compatibility issue fixed

Introduction

Windows and Linux handle text files differently in terms of line breaks. Windows uses (invisible) \r \n characters (carriage return and newline) to represent where the line ends and a new line starts, however, Linux (and all Unices) use \n character for the same purpose. This is the point which makes Linux-created text files look garbled in Microsoft Windows.

There are of course several ways to convert Linux text files to Windows. Intermediate/advanced users may find using sed or awk a perfect tool to convert the files, but in this article I will go with easier solutions.

Kate

KDE's text editor, Kate, has built-in functions to save the text file in Windows format. To do this, open your text file in Kate, go to Tools → End of Line → Windows/DOS. Kate will automatically change all the line breaks and you will be able to save your file in a Windows-proof format.

If you are carrying text files between Linux and Windows computers frequently, then doing the above may not be your perfect solution. In this case, I recommend telling Kate to save the line breaks as Windows/DOS compliant for every file. Go to Settings → Configure Kate and on the left pane under the “Editor Component” part select “Open/Save” option. In the right pane, select “DOS/Windows” as the “End of Line” and un-tick the “Automatic end of line detection.” Click “Apply” and then “OK” to exit.

If you are using Gnome or any other window manager, you can use Kate without any problems.

Yes, everyone wants graphics, or better, the ability to customize things to suit different situations. I have always suggested programmers regarding interfaces and programs in genre to let the user be comfortable to set and change almost every aspect of program GUI, at least icons, fonts, backgrounds and often ii found some programs being too customizable, on the contrary.

Let's take a look at GRUB 2, also called grub-pc by updates that the Debian distro suggests. GRUB 2 is the successor of the GRUB bootloader, commonly shipped within the majority Linux distributions. Basically i will cover only some graphical aspects that GRUB 2 seems to be strong with: customization of fonts, background, console modes directly set by GRUB 2 itself, no more limitation to the resolution of 640x480 pixels at startup, can be used bigger background pictures also at the resolution of 1650x1050 pixels.

Our favorite kernel parameter vga=791 for example, is now deprecated (if using GRUB 2), and it's a little tricky to set correctly the console mode. The configuration file for GRUB 2 is now called grub.cfg in place of the old menu.lst whose we were addicted, but resides in the same directory /boot/grub. Things are very distribution specific i think, but remain the fact that configuration changes rely on the grub.cfg file that we have to alter in some way. Debian is putting the defaults into /etc/default/grub where you can find and set common used parameter easy to understand.

"For example i use Debian within VirtualBox at a resolution of 1280x800 for the console and also for the Xorg server. If you want you to start with this resolution also for GRUB 2 (remember in the past was very limited this feature, and if you are using VirtualBox or other virtualization programs the annoying result was in resizing the window and than enlarging upon the system goes into graphical mode, for example, with the splash screen: usplash, splashy and others), very nice, no more discrepancies between modes: the line to change into the /etc/default/grub file is GRUB_GFXMODE=1280x800 and then issuing update-grub. The resulting action is to write the line set gfxmode=1280x800 into the grub.cfg file."

We are half a way to our objective, to change also the resolution of our console. We need two conditions, the terminal must be set to insmod vbe line MUST be present in your configuration file (this ensure correct console mode settings, if you note this instruction is almost identical to load a kernel module) and the option gfxpayload=keep MUST be set. This will keep our 1280x800 resolution also for the console, YEAH! no more resizing on VirtualBox! and this is not the end. Someone reported that adding gfxpayload=my_resolution will be able to set a different resolution for the console instead of having the same of the GRUB 2 menu, sincerely i have not tested it. Why i have not tested it? The strong point is that to change grub.cfg requires a little more effort than editing it with a text editor, because all your changes will be discarded when you run the command update-grub.

/boot/grub/grub.cfg excerpt :

setgfxmode=1280x800
setgfxpayload=keep
insmod gfxterm
insmod vbe

update-grub reads the configuration stored in the /etc/default/grub file and the scripts that resides into the /etc/grub.d directory at least on Debian (i suppose is the same for other distributions). To set the option gfxpayload=keep i had to modify one of this file cause i discovered that this line MUST be the next after the gfxmode one, like you can note above.

You have to find the file or script responsible to change the content of your grub.cfg configuration file and append the appropriate line, after the gfxmode sentence, gfxpayload=keep to keep the same resolution of the GRUB 2 menu for the console (wider resolutions result in smaller console fonts). In my case i had to edit the script 00_header stored into the /etc/grub.d directory.

There are other scripts into this directory, responsible to set other parameters, like theme (background picture an font color), distribution and custom OS. To change the background image of your GRUB 2 menu is almost the same process, find the script or configuration file that change the attribute of the background_image instance of the grub.cfg, and change the line pointing to the image (usually a .png or .tga file) with the one you like, i have tested it with a resolution of 1650x1050 pixels modifying the script 05_debian_theme, in my case, stored into /etc/grub.d directory as well.

Install Moodbar for Amarok on Ubuntu

First,install the compiler by this command:

sudo apt-get install build-essential

And install the libraries and required programs

sudo apt-get install fftw3-dev libgstreamer0.10-dev gstreamer0.10-plugins-base gstreamer-tools gstreamer0.10-plugins-ugly gstreamer0.10-plugins-good

Download and extract moodbar :

wget http://pwsp.net/~qbob/moodbar-0.1.2.tar.gz

tar -xzvf moodbar-0.1.2.tar.gz

Now,go into the directory and compile:

cd moodbar-0.1.2

./configure --prefix=`pkg-config --variable=prefix gstreamer-0.10`

make

sudo make install

Launch Amarok and go to “Settings -> Configure Amarok” and from “General“, select “Use moods“. There are three different colour moods to choose from.

View personal and system fonts

As root, open nautilus/dolphin window and type "fonts:///" in the location bar.

Fix for Openoffice spellcheck problem

If spellcheck doesn't work out of the box, check the language set in the Font tab of your text style. Select English there and spellcheck will be activated.

Another way i found: Go to regional and language in system settings and choose the language US english/ UK english from there. It should be fine after that.

Rebuild Icon Cache(Ubuntu)

Sometimes the icons go bad like some broken icons or no icons at all. To fix all icons, type this in the terminal:

sudo gtk-update-icon-cache --force --ignore-theme-index /usr/share/icons/hicolor

Remove menu delay in Ubuntu(Gnome)

Type

echo "gtk-menu-popup-delay = 0" >> ~/.gtkrc-2.0

in a terminal

And it simply removes the little delay when navigating menus.

Force Resolution

Its been an issue with Kubuntu 10.04 that the resolution doesn't stick after rebooting system. The workaround for this is to set the resolution every time you login by adding this program entry into autostart.

xrandr --output VGA1 --mode 1280x1024 (where VGA1 is the name of your display, type xrandr in terminal to find out)

Kill Desktop Manager (Desktop Environment)

It may happen that sometimes a desktop manager like lxde or kde doesn't load properly and you're stuck somehwere in between login and full desktop loaded states. This command can be of real help there and then :

sudo kstop kdm or sudo kstop gdm

You need to type this in shell. Press Ctrl+Alt+F1 to go to shell. It will work even if login doesn't work. After the desktop manager is stopped, type startx and then press Ctrl+Alt+F7 to go back to the login screen where you can choose another desktop manager like Gnome and login like normal.

Restore Gnome Desktop

There is a way to reset your Desktop settings back to their defaults in Gnome.

If you don’t have access to your graphical (GUI) desktop to delete these folders in Nautilus or you’re stuck at the login screen, drop to a terminal by hitting CTRL + ALT + F1, login to your account, and run this command:

rm -rf .gnome .gnome2 .gconf .gconfd .metacity

Get back to your GUI desktop by hitting CTRL + ALT + F7.

Login and VOILÀ! Just like the first time you ever logged into your Gnome desktop.

Fix Filesystem errors

Sometimes linux wont boot properly if the filesystem(ext3/ext4/etc.) has become corrupt.

For fixing filesystem errors use a linux live cd and type in the terminal

fsck /dev/sda1 (assuming sda1 has your linux partition)

No comments:

Linux Tips and Tricks

  Helpful Tips and Tricks for Linuxbies Disclaimer :  I came upon these tips and tricks on the Internet searching for solutions to the probl...