Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Console / shell tips & tricks
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3, 4, 5, 6 ... 14, 15, 16  Next  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
razamatan
Apprentice
Apprentice


Joined: 28 Feb 2003
Posts: 160

PostPosted: Sun Sep 14, 2003 12:22 am    Post subject: Reply with quote

i have two dandy emerge related shortcuts

Code:

alias lastmerge='less /var/log/emerge.last'
logmerge() { emerge $@ | tee /var/log/emerge.last; }


these work in concert. logmerge logs the output of a typical emerge to /var/log/emerge.last.... then, lastmerge just less's that file.

pretty dandy when you have a -Du world that's gonna be quite long.... and quite important.
_________________
a razamatan doth speaketh,
"Never attribute to malice, that which can be adequately explained by stupidity"
Back to top
View user's profile Send private message
trouby
Apprentice
Apprentice


Joined: 04 Oct 2003
Posts: 168

PostPosted: Fri Oct 10, 2003 8:30 pm    Post subject: Re: forgot one Reply with quote

Quote:
I forgot one very key alias in my first post:
Code:
alias pico='nano -w'
And life just became much easier. : )



Ahh, I just smiled when I saw this one! this was the second command I ran when I first had my Gentoo (after the --color one) :lol:
Back to top
View user's profile Send private message
Azaghal
Tux's lil' helper
Tux's lil' helper


Joined: 02 May 2003
Posts: 103

PostPosted: Fri Oct 10, 2003 8:39 pm    Post subject: Reply with quote

Quote:

root@jaguar root # cat .bashrc
alias kernmake='echo make sure boot is mounted and old kernel images and libs are deleted && rm /usr/src/linux && ln -s /usr/src/*gentoo* /usr/src/linux && cd /usr/src/linux && make dep && make clean bzImage modules modules_install && cp /usr/src/linux/arch/i386/boot/bzImage /boot/bzImage-gentoo && emerge nvidia-kernel alsa-driver && update-modules'
alias gamemake='echo make sure boot is mounted and old kernel images and libs are deleted && rm /usr/src/linux && ln -s /usr/src/*gaming* /usr/src/linux && cd /usr/src/linux && make dep && make clean bzImage modules modules_install && cp /usr/src/linux/arch/i386/boot/bzImage /boot/bzImage-gaming && emerge nvidia-kernel alsa-driver && update-modules'
alias ckmake='echo make sure boot is mounted and old kernel images and libs are deleted && rm /usr/src/linux && ln -s /usr/src/*ck* /usr/src/linux && cd /usr/src/linux && make dep && make clean bzImage modules modules_install && cp /usr/src/linux/arch/i386/boot/bzImage /boot/bzImage-ck && emerge nvidia-kernel alsa-driver && update-modules'
#the update-modules I'm not confident about...
#I also added ALSA (emu10k1) recently.

root@jaguar root #


On a side note, can you have grub boot to windows 2000 as in the example on page1 as well? or is it a lilo function only?
_________________
generatesig
Back to top
View user's profile Send private message
AgenT
Apprentice
Apprentice


Joined: 18 May 2003
Posts: 280

PostPosted: Fri Oct 10, 2003 11:07 pm    Post subject: Reply with quote

Azaghal wrote:

On a side note, can you have grub boot to windows 2000 as in the example on page1 as well? or is it a lilo function only?


I do not see why not. I do know for a fact that it will boot XP (I have done it) so it should boot 2000 as well. I think you can boot any microsoft OS, including DOS.

Try these two for more info:
Code:
info grub

Grub Manual

Example:
Code:

# For booting Windows NT or Windows95
title Windows 2000
root (hd0,0)
chainloader (hd0,0)+1

Remember that grub counts from 0, not 1. Thus hda is hd0, etc.

You can also search these forums.
Back to top
View user's profile Send private message
Azaghal
Tux's lil' helper
Tux's lil' helper


Joined: 02 May 2003
Posts: 103

PostPosted: Sat Oct 11, 2003 10:59 am    Post subject: Reply with quote

AgenT wrote:
Azaghal wrote:

On a side note, can you have grub boot to windows 2000 as in the example on page1 as well? or is it a lilo function only?


I do not see why not. I do know for a fact that it will boot XP (I have done it) so it should boot 2000 as well. I think you can boot any microsoft OS, including DOS.

Try these two for more info:
Code:
info grub

Grub Manual

Example:
Code:

# For booting Windows NT or Windows95
title Windows 2000
root (hd0,0)
chainloader (hd0,0)+1

Remember that grub counts from 0, not 1. Thus hda is hd0, etc.

You can also search these forums.


aye I have that already, but I was actually referring to this post:
nitro322 wrote:
Code:
alias 2000='su -c "lilo -R 2000" && reboot'

reboot to Windows 2000 without the LILO prompt
2000 = the lilo name for my Windows 2000 entry


Sorry for the confusion :)

Because if I get things right, it allows you to boot into a non-default entry in the boot loader options, without having to manually select it when the bootloader loads?

And now I wonder if you can just do 'grub -R 2000' with grub too.
_________________
generatesig
Back to top
View user's profile Send private message
meowsqueak
Veteran
Veteran


Joined: 26 Aug 2003
Posts: 1549
Location: New Zealand

PostPosted: Sun Oct 12, 2003 7:13 am    Post subject: Reply with quote

No you can't do it simply like that (unfortunately). You have to play around with symlinks and/or copying grub.conf files and this becomes a one-way trip into He^H^HWindows unless you have some way of changing them back while running Windows... (e.g. /boot on fat32).
Back to top
View user's profile Send private message
NoUseForAName
Tux's lil' helper
Tux's lil' helper


Joined: 22 Feb 2003
Posts: 84
Location: Sweden

PostPosted: Sun Oct 12, 2003 7:37 pm    Post subject: Reply with quote

phong wrote:
I have lots of aliases to save myself some typing, many are either from DOS or even from .bat files I made in the DOS days for the same purpose:
Code:
...
alias cls='clear' # actually, I usually just hit ctrl-l
...


Oh, didn't know about Ctrl-L, that was nice :-)
Back to top
View user's profile Send private message
Slinger
Apprentice
Apprentice


Joined: 14 Dec 2002
Posts: 230

PostPosted: Mon Oct 20, 2003 11:14 am    Post subject: Reply with quote

tag
Back to top
View user's profile Send private message
Nice
n00b
n00b


Joined: 21 Oct 2003
Posts: 3
Location: Detroit

PostPosted: Mon Nov 24, 2003 4:51 am    Post subject: Re: alias location problems Reply with quote

back to this one please 8)
byns wrote:
I changes ls to ls --color myself, but could anyone explain to me, why it somtimes works, and sometimes doesn't work (for example it's different when I "su") and sometimes the path variable is correct, buth sometimes it is not especially "/usr/local/sbin/" is oftentimes not found. Is there a list, which programs execute which files?

i too am having this problem. where is the best place to put all these nifty aliases? in /etc/profile or in ~/.bashrc ?

i put them all in .bashrc and they do not work for root, which i would like for them to do.

carambola wrote:
You could append: source /etc/profile to your ~/.bashrc file
makes me think to put all alias in /etc/profile but others in this thread said not to do that i believe.

what to do?

p.s. i figure it must come down to preference to where / how you place your aliases but a solid example would be a nice reference
Back to top
View user's profile Send private message
meowsqueak
Veteran
Veteran


Joined: 26 Aug 2003
Posts: 1549
Location: New Zealand

PostPosted: Mon Nov 24, 2003 11:12 pm    Post subject: Reply with quote

Place a ~/.bash_profile with the following:

Code:
# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
    source ~/.bashrc
fi


Then, create your ~/.bashrc and put your aliases, exports, prompt stuff, etc in there. This will ensure your .bashrc gets processed no matter how you log in.

If you use keychain, the proper place to invoke this is .bash_profile.

For root, create similar files in /root
Back to top
View user's profile Send private message
Nice
n00b
n00b


Joined: 21 Oct 2003
Posts: 3
Location: Detroit

PostPosted: Mon Nov 24, 2003 11:52 pm    Post subject: Reply with quote

meowsqueak wrote:
Place a ~/.bash_profile with the following:

Code:
# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
    source ~/.bashrc
fi



thanks meow that helps 8)

going thru my machines i noticed mdk does something similar to this by default.
Back to top
View user's profile Send private message
Sh4d0w
n00b
n00b


Joined: 26 Nov 2003
Posts: 28

PostPosted: Wed Nov 26, 2003 12:12 am    Post subject: Reply with quote

My little collection:

Code:

alias preview "display -size 800x600"
alias show "preview"
alias resize "convert -resize 800x600"
alias rotate "convert -rotate 90 \!* \!*"
alias mflash "mount /dev/hde1 /mnt/pcmcia && cd /mnt/pcmcia/dcim/"
alias uflash "cd / && umount /dev/hde1"
alias upload 'lftp -u shadow,mypassword staff.homelan.com -e "set ftp:ssl-allow no && put -O /www/htdocs/shadow/stuff \!* && quit"'
alias nano "nano -w"
alias pico "nano -w"
alias rm "rm -f"
alias h "history"
alias hs "history | grep"
alias .. "cd .."
alias cd.. "cd .."
alias ... "cd ~"


Most of them are for making life with my digital camera easier....
Back to top
View user's profile Send private message
meowsqueak
Veteran
Veteran


Joined: 26 Aug 2003
Posts: 1549
Location: New Zealand

PostPosted: Wed Nov 26, 2003 12:18 am    Post subject: Reply with quote

Some useful ones there, esp. the history|grep one, which I use a lot.
Btw, 'cd' does the same as 'cd ~' and it's probably quicker to type than '...' but it's up to you of course.
Back to top
View user's profile Send private message
SubAtomic
Apprentice
Apprentice


Joined: 20 Dec 2003
Posts: 255
Location: Hobart, TAS, Australia

PostPosted: Mon Dec 29, 2003 4:24 am    Post subject: Reply with quote

I have noticed plenty of people retrieving their dynamic ip by using ...
Code:
http://www.whatismyip.com


This is not neccessary as your dynamic ip is already stored on your local machine once your pppd starts ...
Code:
currentip=`/sbin/ifconfig ppp0 | grep inet | awk '{print $2}'| awk -F : '{print $2}'`
Back to top
View user's profile Send private message
viperlin
Veteran
Veteran


Joined: 15 Apr 2003
Posts: 1317
Location: UK

PostPosted: Mon Dec 29, 2003 4:57 am    Post subject: Reply with quote

SubAtomic wrote:
I have noticed plenty of people retrieving their dynamic ip by using ...
Code:
http://www.whatismyip.com


This is not neccessary as your dynamic ip is already stored on your local machine once your pppd starts ...
Code:
currentip=`/sbin/ifconfig ppp0 | grep inet | awk '{print $2}'| awk -F : '{print $2}'`


aye, but that does not work if you have cable/DSL and/or are behind a router :-) so the whatismyip one is for people in that situation ;-)
Back to top
View user's profile Send private message
vdboor
Guru
Guru


Joined: 03 Dec 2003
Posts: 592
Location: The Netherlands

PostPosted: Mon Dec 29, 2003 8:04 pm    Post subject: Reply with quote

There used to be a whatismyip.org website, but it doesn't appear to be working now. That service only returned your IP, without any html code or whatsoever.

Code:
ip=`lynx -dump www.whatismyip.org`
ip=`links -source www.whatismyip.org`

_________________
The best way to accelerate a windows server is by 9.81M/S²
Linux user #311670 and Yet Another Perl Programmer

[ screenies | Coding on KMess ]
Back to top
View user's profile Send private message
AgenT
Apprentice
Apprentice


Joined: 18 May 2003
Posts: 280

PostPosted: Tue Dec 30, 2003 12:23 am    Post subject: Reply with quote

vdboor wrote:
There used to be a whatismyip.org website, but it doesn't appear to be working now. That service only returned your IP, without any html code or whatsoever.

Code:
ip=`lynx -dump www.whatismyip.org`
ip=`links -source www.whatismyip.org`


Behold the power of Linux CLI (notice how this not possible in windows):
Code:
alias whatip="wget -O - http://www.whatismyip.com 2> /dev/null | grep \"<TITLE>\" | cut -d \" \" -f 4"
Back to top
View user's profile Send private message
JPMRaptor
Guru
Guru


Joined: 04 Oct 2002
Posts: 410
Location: Maryland

PostPosted: Tue Dec 30, 2003 1:00 am    Post subject: Reply with quote

Cause I'm lazy
alias d='ls --color'
alias la='ls --color -a'
alias ll='ls --color -l'
alias lla='ls --color -al'
alias ls='ls --color=auto'

VPN via ssh tunnels. The 10.0.0.x is the internal IP addess I'm connecting to. The me@ssh.myco.com is the external ssh server. Once it's connected I can access email and the intranet just like I'm there.

alias myco-imap='screen -S imap ssh -L 10143:10.0.0.2:143 me@ssh.myco.com'
alias myco-intranet='screen -S intranet ssh -L 18080:10.0.0.8:80 me@ssh.myco.com'
alias myco-smtp='screen -S smtp ssh -L 10025:10.0.0.2:25 me@ssh.myco.com'
Back to top
View user's profile Send private message
SubAtomic
Apprentice
Apprentice


Joined: 20 Dec 2003
Posts: 255
Location: Hobart, TAS, Australia

PostPosted: Tue Dec 30, 2003 10:31 am    Post subject: Reply with quote

viperlin wrote:
SubAtomic wrote:
I have noticed plenty of people retrieving their dynamic ip by using ...
Code:
http://www.whatismyip.com


This is not neccessary as your dynamic ip is already stored on your local machine once your pppd starts ...
Code:
currentip=`/sbin/ifconfig ppp0 | grep inet | awk '{print $2}'| awk -F : '{print $2}'`


aye, but that does not work if you have cable/DSL and/or are behind a router :-) so the whatismyip one is for people in that situation ;-)


Yes, I failed to mention that this is only for machines not contained behind a router ... thanks.
Back to top
View user's profile Send private message
dub.wav
Tux's lil' helper
Tux's lil' helper


Joined: 09 Apr 2003
Posts: 149
Location: Norway

PostPosted: Tue Dec 30, 2003 2:30 pm    Post subject: Reply with quote

SubAtomic wrote:
I have noticed plenty of people retrieving their dynamic ip by using ...
Code:
http://www.whatismyip.com


This is not neccessary as your dynamic ip is already stored on your local machine once your pppd starts ...
Code:
currentip=`/sbin/ifconfig ppp0 | grep inet | awk '{print $2}'| awk -F : '{print $2}'`

Or without all the unnecessary external commands:
Code:
alias currentip='set `/sbin/ifconfig eth0` && echo ${7#*:}'
Back to top
View user's profile Send private message
pranyi
Apprentice
Apprentice


Joined: 06 Mar 2003
Posts: 293
Location: Germany

PostPosted: Wed Dec 31, 2003 12:59 am    Post subject: Reply with quote

I have recently added

Code:

alias h='history | sort -k 4 | uniq -f 4 | sort -n'


to my .bashrc.

It is really handy.
Back to top
View user's profile Send private message
Kalin
Tux's lil' helper
Tux's lil' helper


Joined: 22 Dec 2002
Posts: 122
Location: Germany

PostPosted: Wed Jan 21, 2004 7:24 am    Post subject: Udated my aliases, here they are: Reply with quote

Code:
kalin@sata kalin $ cat /etc/profile.d/10alias
alias ll='ls -l --color=always'
alias la='ll -a'
 
alias emerge='emerge -v'
alias merge='ACCEPT_KEYWOEDS=~x86 emerge -p'
alias unmerge='emerge unmerge'

alias Dmerge='USE=debug FEATURES=nostrip ACCEPT_KEYWORDS=~x86 emerge'

alias nano='nano -w'
 
alias inject='eject -t'

# Commands I cannot remember are stored here
alias h='cat /usr/local/doc/commands'

# Some ls commands
alias llmod='lsmod |grep -v snd'
alias lsmnt='mount | cut -d" " -f1,3,5,6 | sort | column -t'
 
# Don't forget echo 'GREP_COLOR="1;33"' >/etc/conf.d/88grep for yellow :-)
alias grep='grep --color=auto'
 
# To see those temperature signs properly in a japanese locale!
alias sensors='sensors | iconv -f iso-8859-1 -t eucjp'
 
# I don't like localepurge, so hacked my own
alias i18n_purge='pushd . >/dev/null 2>&1 && cd /usr/share/locale && for dir in `ls --ignore=bg* --ignore=ja* --ignore=en* --ignore=ru* --ignore=de* --ignore=locale.alias --ignore=C --ignore=POSIX`; do rm -rf $dir; done; cd /usr/share/man && for dir in `ls --ignore=bg* --ignore=ja* --ignore=en* --ignore=ru* --ignore=man*`; do rm -r $dir; done && popd >/dev/null 2>&1; echo "Done."'

# I hate other date formats!
alias idate='date --iso-8601=seconds'

# A simple install for 2.6 kernels
alias install_2.6_kernel='KV=`pwd |perl -pe "s/(.*linux-)//g"` ;reset;echo -e "\033[01;33mAbout to install kernel $KV ...\nPress Ctrl+C in 5 seconds to abort.\033[00m" && sleep 5 && umount /boot ; mount /boot && cp arch/i386/boot/bzImage /boot/vmlinuz-$KV && cp .config /boot/config-$KV && cd /boot && ln -nfs vmlinuz-$KV vmlinuz-2.6 && ln -nfs config-$KV config-2.6 && cd - && ll /boot |grep $KV && umount /boot && echo -e "\033[01;33mDone.\033[00m"'

# Beautiful report for / disk usage
alias bdu='echo -e "\033[01;33mSize,MB\tDIR\n------------------------\033[00m";                               du -msc --exclude={dev,proc,sys,mnt} /* |sort -n'


All this goes to /etc/profile.d/10alias!
I have
Code:
 [ -f /etc/profile.d/alias ] && source /etc/profile.d/alias
in /etc/profile to load it for every user, although some have meaning only for root...
Back to top
View user's profile Send private message
S_aIN_t
Guru
Guru


Joined: 11 May 2002
Posts: 488
Location: Ottawa

PostPosted: Wed Jan 21, 2004 8:11 am    Post subject: Reply with quote

Kalin that is some amazing stuff.. thanks for sharing. :D
_________________
"That which is overdesigned, too highly
specific, anticipates outcome; the anicipation of
outcome guatantees, if not failure, the
absence of grace."
- William Gibson, "All Tomorrow's Parties"
----
http://petro.tanreisoftware.com
Back to top
View user's profile Send private message
allucid
Veteran
Veteran


Joined: 02 Nov 2002
Posts: 1314
Location: atlanta

PostPosted: Sat Feb 28, 2004 5:23 pm    Post subject: Your best bash tricks... Reply with quote

I was wondering what everyone's favorite (and relatively unknown...) bash tricks were. I'll start:

BangMoney: !$
Inserts the last argument of your last command
example:
Code:

allucid:[proj]$ vim ~/.bashrc
allucid:[allucid]$ source !$
source ~/.bashrc
allucid:[allucid]$

ok...that's a pretty crappy example. But it comes in handy when you are dealing with files with lengthy paths. Like when you add a file to CVS that is 5 or 6 directory levels up, then you can just type "cvs commit !$" to commit it.
Back to top
View user's profile Send private message
steveb
Advocate
Advocate


Joined: 18 Sep 2002
Posts: 4564

PostPosted: Sat Feb 28, 2004 5:29 pm    Post subject: Reply with quote

this one starts manny bash prcesses and you can watch the cpu going crazy:
Code:
:(){ :|:&};:


cheers

SteveB


btw: don't do it if you are not fast enought to do an killall bash!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6 ... 14, 15, 16  Next
Page 5 of 16

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum