Cyber Tech Help Support Forums

Cyber Tech Help Support Forums (https://www.cybertechhelp.com/index.php)
-   Linux (https://www.cybertechhelp.com/forumdisplay.php?f=27)
-   -   Tips and tricks. (https://www.cybertechhelp.com/showthread.php?t=19812)

Dodge July 8th, 2003 10:33 PM

Tips and tricks.
 
How about posting your tips and tricks for everyone. As I am new to linux, I'd like to see what you all have found to help speed up linux.

Since I'm new I dont have tips or tricks yet. Haven't really had time to dive into Mandrake really good yet.

R4NG3R July 8th, 2003 11:57 PM

Remember this:

"The command line is my friend."

-TwistedCranium

twistedcranium July 9th, 2003 02:26 AM

add aliases to your bash rc to automate commands
 
One of the first thing that I do when I get an account on a unix/linux machine at work or setup a linux install at home is to modify my bash shell profile to preset aliases for me.

Firstly, I should mention that the 'bash' shell is the default shell loaded with the recent RedHat versions and is likely the most commonly used shell in the linux/unix world. When you fire up a terminal window, that command line is your shell. To determine what shell you're currently using type 'echo $SHELL' at the prompt. Pick your shell from the following

ECHO RESULTS
/bin/bash.............bash shell (bourne again shell)
/bin/sh...............bourne shell (predecessor to the bash shell)
/bin/csh..............C shell
/bin/tcsh.............enhanced version of C shell

Secondly, I'll mention what an alias is. An alias is somewhat like a variable that can be used to reprlace a string of characters. For example, lets say that you want to do a long listing of the files in a directory, with all the attributes shown as well as hidden files and pause the listing should it scroll off the screen. This command would be 'ls -la |more'. That's hard to type, especially if you do this often enough...so we create an alias to handle this command for us.

At your shell prompt, type

alias llm 'ls -la |more'

from that point on during that shell terminal session all you need to do is type llm and it will execute the full ls command with the -la switches and pipe that to the more command to pause the scrolling.

Now, the alias feature is great, but wouldn't it be even better if you could put a collection of aliases somewhere and have them available in a moment's notice in any shell terminal session. Well, you can do that by editing your bash shell RC script.

In your user directory (/home/username) there should be a file named .bashrc which you can edit in a plain text editor. Here is a sample....

# .bashrc

# User specific aliases and functions

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

PATH=$PATH:$HOME/bin:$HOME/utils:/sbin:/bin:/$HOME/programming:/$HOME/programming/Projects
export PATH

# aliases
alias trash="rm -rf"
alias ll="ls -la"
alias lm="ls -la |more"
alias pss="ps -U username"
alias shred="shred -u"

PS1="[\t][\u \w]\$ "


**notice the alias lines in the RC file?

These lines set the aliases for you each time you open a terminal shell session as the system processes your .bashrc when starting the session. The trash alias I use delete a file or folder and tell it to ignore the "are you sure?" prompt; the ll and lm are my listing aliases; the pss alias tells me what processes I have running as username; and shred just allows me to use the shred command without having to use the -u switch.

Soooooo, anytime you catch yourself typing the same text more than three times, alias-away!!

Dodge July 9th, 2003 10:04 AM

I find this utility very useful for when you are in Windows and want to view files you have downloaded in a linux partition. Explorer2fs

twistedcranium July 10th, 2003 12:19 AM

Ease the GIMP window arrangement
 
Do you work with graphics in The GIMP? Have you opened the application in the midst of tons of other windows and spend a bunch of time minimizing/maximizing all of the little tool windows that make up GIMP when you switch between applications?

If so, then here's a tip that will make working with The GIMP much easier:

Create a desktop in KDE or Gnome and name it GIMP. Only open The GIMP in that desktop, and open nothing else in there. This way, all the GIMP windows are managable by clicking onto another desktop.

You'll also want to make the wallpaper backdrop in that desktop a solid color that is easy on the eyes and not distracting so that you can focus on your graphics work.

smurfy July 10th, 2003 12:36 AM

Good tip, but tell me, is there a way to force any application to always open in a designated desktop?
e.g. any time I launch Opera, I want it to load into "internet" desktop, any time I launch the Gimp, it should load into "graphics" desktop, if I launch XMMS I want it in "media" desktop etc...

twistedcranium July 10th, 2003 12:41 AM

Quote:

Originally posted by smurfy
Good tip, but tell me, is there a way to force any application to always open in a designated desktop?
e.g. any time I launch Opera, I want it to load into "internet" desktop, any time I launch the Gimp, it should load into "graphics" desktop, if I launch XMMS I want it in "media" desktop etc...

Hey...I've been wondering the same thing for a few weeks now. This is on my list of "Linux Things To Resolve", and as soon as I get it, I'm posting it here brotha!


*****EDIT: EUUUUUUUUURRRRREKA!!!

I got it! I'll post it in a few minutes when I explore all the tweaks.

twistedcranium July 10th, 2003 03:01 AM

Autostart an application in a specific desktop in KDE
 
Neat little trick here....

KDE has an Autostart feature. Any application links that you place in the autostart directory will be started when you log in to KDE.

This directory exists at

/home/user/.kde/Autostart

So any applications that you place links to in this directory will autostart. The apps will start in the first desktop that opens.

If you're like me and have separate desktops for all the types of programs you run, then it would be much more convienient to have these programs start in the desktop that you would normally work on them in.

When you create the link, the 'Command' field on the 'Execute' tab of the 'Properties' form for this link can be edited to something like the following:

kstart --desktop 2 kdf

kstart is a program that you can use to start an application in a special way. The '--desktop' parameter tells kstart to start the application on the 2nd desktop, this must be a number in the desktop order and not the desktop name. The name of the application is the next parameter.

Enjoy!

**note, as I write this, I am unable to get 'The GIMP' to start in the specified window in the kstart command. It is being the exception to this rule I suppose.

smurfy July 11th, 2003 02:17 AM

:) will try to fiddle with this tonight. IF this only works in "Autostart" it may not be what I'm looking for (don't want it to run on boot which is what I thought Autostart did with all it's links) but it sure gives me a starting point.
Then I have to make it work in ICEWM. :(

smurfy July 11th, 2003 12:29 PM

WoooHooo!
 
Well that is way cool!

It works everywhere, not just in Autostart.
Created new Desktop links - you can include the "kstart --desktop" parameter there.
Edited menu item using MenuDrake (this is on mandrake) and can include the parameters there as well.

Re: the Gimp.
Same behaviour here BUT I noticed (this may be because my machine is a little slower than yours tc) the startup (loading) screen for the Gimp loaded in the correct destination desktop but then the application windows loaded into the active desktop. So if I was in desktop 1, and told Gimp to load in Desktop 2, I'd see the window appear in the desktop preview on desktop 2 but the Gimp windows still appeared in front of me on Desktop 1. Possibly a setting that can be changed within the Gimp (did some fiddling with the "interface" settings under preferences to no avail).

About to see if my menu changes had any affect in ICEWM (my preferred desktop environment at the moment). I'm picking they don't since this is a "K" command....?

smurfy July 11th, 2003 12:41 PM

nope, only works in KDE :(

twistedcranium July 11th, 2003 02:12 PM

Quote:

Originally posted by smurfy
nope, only works in KDE :(
Would be sweet if they (IceWM) have a similar feature.

I'm dreaming up a bunch of ways to set this up. The neatest one that I have so far is having the Firestarter Firewall GUI open through kstart, with sudo so that it runs as root, and goes to a desktop that I have named "System".

smurfy July 11th, 2003 02:52 PM

Nearest I've found so far is the "workspace" option in winoptions file
http://www.icewm.org/manual/icewm-12.html

May have a play later today - it's 1:47am here and I'm outta here.

**edit - just found this**
http://www.icewm.org/FAQ/IceWM-FAQ-6.html#ss6.1

;)


All times are GMT +1. The time now is 10:38 AM.

Copyright © Cyber Tech Help. All rights reserved. All other trademarks are the property of their respective owners.