Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
In the bash shell you could also type the first few letters of the very long file name and then hit tab and it will fill it in for you, but your way is cool too, trade14u.
in bash, you can use C-r (control + r) to search in the command history.
for example, suppose you did a "less /usr/src/linux-2.6.4/Documentation/usb/usb-serial.txt" a couple of days ago, and you want to read the file again but you cannot remember the path anymore, only that the word 'serial' was in it. what you can do is search in your command history for the word 'serial' by pressing C-r, then typing 'serial'. the matching command line will be displayed as you type each letter. if the result is not yet the command you were looking for, then press C-r again to step back in your history until the right command appears, and press enter.
it's all on the man page, you can jump right there by searching for 'reverse'. there's also a list of other useful bindings, for example moving back/forward one word, deleting back/forward one word. these bindings are also good to memorize because they work in emacs too. (and that's actually how i found them in the first place, i thought i was in an emacs window, haha!)
this is more likely known to a lot of linux users, but one of the things I always like to set up immediately after I've installed a new distro is change the .bashrc for root
this is how my /root/.bashrc looks like:
Code:
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
export PATH=$PATH:/sbin
export PS1="\\033[0;31m\u\\033[1;31m@\\033[0;31m\h\\033[1;31m:\\033[0;31m\w\\033[1;31m\\$\n: \\033[0;37m"
It's the RED code that I added. It pretty much reminds me ALWAYS whenever I'm logged on as root - you should give that a try :P
simple, but quite useful (of course you can add many more changes to it)
Last edited by slackmagic; 03-29-2004 at 05:33 AM.
Originally posted by jon1591 Hi guys, I think this is a cool thread but I would like to know one about using &&. Is there any difference between doing:
Code:
make dep && make bzImage && etc...
or doing
Code:
make dep& make bzImage& etc...
Jon
& - forks a job to the background
&& is a boolean operator I belive. not sure exactly how to explain it but, simply
do && do && do
is 'do' and 'do' and 'do'
I guess thats a pretty hoakie explanation.
OK here's one someone might find useful. Have you ever wanted ls to print the permissions in numbers instead of "rwxr--r--" or whatever? Make this a shell alias:
Code:
ls -l | sed -e 's/rwx/7/g' | sed -e 's/r--/4/g' | sed -e 's/r-x/5/g' | sed -e 's/rw-/6/g' | sed -e 's/---/0/g'
It won't work for every file, but it should for most normal files.
edit: this could be written more succinctly as:
Code:
ls -l | sed -e 's/rwx/7/g' -e 's/r--/4/g' -e 's/r-x/5/g' -e 's/rw-/6/g' -e 's/---/0/g'
I always thought aliases resided in memory so I prefer to write small scripts and place them in /usr/bin. Example. I have a box named cromag that I frequently ssh into.
touch cromag && echo "ssh user@192.168.1.125" > cromag && chmod +x cromag
sudo mv cromag /usr/bin
To find your current resolution:
xvidtune -show
OR
xrandr|grep \*
To enable/disable energystar features:
xset +/-dpms
If you're a bad typist like me and commonly transpose your last two letters of a command you can use CTRL+T to switch them like so:
apt-gte
CTRL+T
(now your typo gets corrected)
apt-get
Last edited by rickenbacherus; 06-16-2004 at 06:36 PM.
I'll add to what retiredsoldier posted............In my ~/.bashrc I like to define all the colors first, then export them so my PS1 is a little easier to create............
Code:
# Color Variables for Prompt
GRAD1='\333\262\261\260'
GRAD2='\260\261\262\333'
YLOBRN='\[\033[01;33;43m\]'
WHTBRN='\[\033[01;37;43m\]'
REDBRN='\[\033[01;31;43m\]'
BLUBRN='\[\033[01;34;43m\]'
GRNBRN='\[\033[00;32;43m\]'
REDBLK='\[\033[00;31;40m\]'
PPLBLK='\[\033[01;35;40m\]'
WHTBLK='\[\033[01;37;40m\]'
NONE='\[\033[00m\]'
HBLK='\[\033[00;30;30m\]'
HBLU='\[\033[01;34;34m\]'
BLU='\[\033[01;34m\]'
YEL='\[\033[01;33m\]'
WHT='\[\033[01;37m\]'
PRPL='\[\033[00;35m\]'
RED='\[\033[01;31m\]'
GRN='\[\033[01;32m\]'
GRAY='\[\033[01;30m\]'
PINK='\[\033[01;35m\]'
NORM='\[\033[01;00;0m\]'
CYAN='\[\033[01;36m\]'
export GRAD1 GRAD2 YLOBRN WHTBRN REDBRN BLUBRN GRNBRN REDBLK PPLBLK WHTBLK NONE HBLK HBLU BLU YEL WHT PRPL RED GRN GRAY PINK NORM CYAN
# what I use for normal users
PS1="$CYAN[\s]$YEL[\t] $GRN\u$YEL@$BLU\h $WHT[\w]\$$NONE $NORM"
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.