Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Discussion & Documentation Documentation, Tips & Tricks
  • Search

Console / shell tips & tricks

Unofficial documentation for various parts of Gentoo Linux. Note: This is not a support forum.
Post Reply
Advanced search
376 posts
  • Page 5 of 16
    • Jump to page:
  • Previous
  • 1
  • …
  • 3
  • 4
  • 5
  • 6
  • 7
  • …
  • 16
  • Next
Author
Message
razamatan
Apprentice
Apprentice
User avatar
Posts: 160
Joined: Fri Feb 28, 2003 8:51 am
Contact:
Contact razamatan
Website

  • Quote

Post by razamatan » Sun Sep 14, 2003 12:22 am

i have two dandy emerge related shortcuts

Code: Select all

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"
Top
trouby
Apprentice
Apprentice
User avatar
Posts: 168
Joined: Sat Oct 04, 2003 9:59 pm

Re: forgot one

  • Quote

Post by trouby » Fri Oct 10, 2003 8:30 pm

I forgot one very key alias in my first post:

Code: Select all

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:
Top
Azaghal
Tux's lil' helper
Tux's lil' helper
Posts: 103
Joined: Fri May 02, 2003 6:26 pm

  • Quote

Post by Azaghal » Fri Oct 10, 2003 8:39 pm

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
Top
AgenT
Apprentice
Apprentice
User avatar
Posts: 280
Joined: Sun May 18, 2003 4:17 pm

  • Quote

Post by AgenT » Fri Oct 10, 2003 11:07 pm

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: Select all

info grub
Grub Manual

Example:

Code: Select all

# 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.
Top
Azaghal
Tux's lil' helper
Tux's lil' helper
Posts: 103
Joined: Fri May 02, 2003 6:26 pm

  • Quote

Post by Azaghal » Sat Oct 11, 2003 10:59 am

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: Select all

info grub
Grub Manual

Example:

Code: Select all

# 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: Select all

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
Top
meowsqueak
Veteran
Veteran
User avatar
Posts: 1549
Joined: Tue Aug 26, 2003 6:46 am
Location: New Zealand

  • Quote

Post by meowsqueak » Sun Oct 12, 2003 7:13 am

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).
Top
NoUseForAName
Tux's lil' helper
Tux's lil' helper
Posts: 84
Joined: Sat Feb 22, 2003 12:39 pm
Location: Sweden

  • Quote

Post by NoUseForAName » Sun Oct 12, 2003 7:37 pm

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: Select all

...
alias cls='clear' # actually, I usually just hit ctrl-l
...
Oh, didn't know about Ctrl-L, that was nice :-)
Top
Slinger
Apprentice
Apprentice
User avatar
Posts: 230
Joined: Sat Dec 14, 2002 4:55 am

  • Quote

Post by Slinger » Mon Oct 20, 2003 11:14 am

tag
Top
Nice
n00b
n00b
User avatar
Posts: 3
Joined: Tue Oct 21, 2003 1:07 am
Location: Detroit

Re: alias location problems

  • Quote

Post by Nice » Mon Nov 24, 2003 4:51 am

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
Top
meowsqueak
Veteran
Veteran
User avatar
Posts: 1549
Joined: Tue Aug 26, 2003 6:46 am
Location: New Zealand

  • Quote

Post by meowsqueak » Mon Nov 24, 2003 11:12 pm

Place a ~/.bash_profile with the following:

Code: Select all

# 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
Top
Nice
n00b
n00b
User avatar
Posts: 3
Joined: Tue Oct 21, 2003 1:07 am
Location: Detroit

  • Quote

Post by Nice » Mon Nov 24, 2003 11:52 pm

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

Code: Select all

# 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.
Top
Sh4d0w
n00b
n00b
Posts: 28
Joined: Wed Nov 26, 2003 12:07 am

  • Quote

Post by Sh4d0w » Wed Nov 26, 2003 12:12 am

My little collection:

Code: Select all

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....
Top
meowsqueak
Veteran
Veteran
User avatar
Posts: 1549
Joined: Tue Aug 26, 2003 6:46 am
Location: New Zealand

  • Quote

Post by meowsqueak » Wed Nov 26, 2003 12:18 am

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.
Top
SubAtomic
Apprentice
Apprentice
User avatar
Posts: 255
Joined: Sat Dec 20, 2003 6:33 am
Location: Hobart, TAS, Australia

  • Quote

Post by SubAtomic » Mon Dec 29, 2003 4:24 am

I have noticed plenty of people retrieving their dynamic ip by using ...

Code: Select all

http://www.whatismyip.com
This is not neccessary as your dynamic ip is already stored on your local machine once your pppd starts ...

Code: Select all

currentip=`/sbin/ifconfig ppp0 | grep inet | awk '{print $2}'| awk -F : '{print $2}'`
Top
viperlin
Veteran
Veteran
Posts: 1319
Joined: Tue Apr 15, 2003 5:50 pm
Location: UK

  • Quote

Post by viperlin » Mon Dec 29, 2003 4:57 am

SubAtomic wrote:I have noticed plenty of people retrieving their dynamic ip by using ...

Code: Select all

http://www.whatismyip.com
This is not neccessary as your dynamic ip is already stored on your local machine once your pppd starts ...

Code: Select all

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 ;-)
Top
vdboor
Guru
Guru
User avatar
Posts: 592
Joined: Wed Dec 03, 2003 9:31 am
Location: The Netherlands
Contact:
Contact vdboor
Website

  • Quote

Post by vdboor » Mon Dec 29, 2003 8:04 pm

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: Select all

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 ]
Top
AgenT
Apprentice
Apprentice
User avatar
Posts: 280
Joined: Sun May 18, 2003 4:17 pm

  • Quote

Post by AgenT » Tue Dec 30, 2003 12:23 am

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: Select all

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: Select all

alias whatip="wget -O - http://www.whatismyip.com 2> /dev/null | grep "<TITLE>" | cut -d " " -f 4"
Top
JPMRaptor
Guru
Guru
User avatar
Posts: 410
Joined: Fri Oct 04, 2002 12:22 am
Location: Maryland
Contact:
Contact JPMRaptor
Website

  • Quote

Post by JPMRaptor » Tue Dec 30, 2003 1:00 am

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'
Top
SubAtomic
Apprentice
Apprentice
User avatar
Posts: 255
Joined: Sat Dec 20, 2003 6:33 am
Location: Hobart, TAS, Australia

  • Quote

Post by SubAtomic » Tue Dec 30, 2003 10:31 am

viperlin wrote:
SubAtomic wrote:I have noticed plenty of people retrieving their dynamic ip by using ...

Code: Select all

http://www.whatismyip.com
This is not neccessary as your dynamic ip is already stored on your local machine once your pppd starts ...

Code: Select all

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.
Top
dub.wav
Tux's lil' helper
Tux's lil' helper
Posts: 149
Joined: Wed Apr 09, 2003 12:55 pm
Location: Norway

  • Quote

Post by dub.wav » Tue Dec 30, 2003 2:30 pm

SubAtomic wrote:I have noticed plenty of people retrieving their dynamic ip by using ...

Code: Select all

http://www.whatismyip.com
This is not neccessary as your dynamic ip is already stored on your local machine once your pppd starts ...

Code: Select all

currentip=`/sbin/ifconfig ppp0 | grep inet | awk '{print $2}'| awk -F : '{print $2}'`
Or without all the unnecessary external commands:

Code: Select all

alias currentip='set `/sbin/ifconfig eth0` && echo ${7#*:}'
Top
pranyi
Apprentice
Apprentice
User avatar
Posts: 293
Joined: Thu Mar 06, 2003 9:51 pm
Location: Germany

  • Quote

Post by pranyi » Wed Dec 31, 2003 12:59 am

I have recently added

Code: Select all

alias h='history | sort -k 4 | uniq -f 4 | sort -n'
to my .bashrc.

It is really handy.
Top
Kalin
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 134
Joined: Sun Dec 22, 2002 10:32 am
Location: Germany
Contact:
Contact Kalin
Website

Udated my aliases, here they are:

  • Quote

Post by Kalin » Wed Jan 21, 2004 7:24 am

Code: Select all

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: Select all

 [ -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...
Top
S_aIN_t
Guru
Guru
User avatar
Posts: 488
Joined: Sat May 11, 2002 12:59 pm
Location: Ottawa
Contact:
Contact S_aIN_t
Website

  • Quote

Post by S_aIN_t » Wed Jan 21, 2004 8:11 am

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
Top
allucid
Veteran
Veteran
Posts: 1314
Joined: Sat Nov 02, 2002 6:27 pm
Location: atlanta

Your best bash tricks...

  • Quote

Post by allucid » Sat Feb 28, 2004 5:23 pm

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: Select all

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.
help support OpenSSH
Top
steveb
Advocate
Advocate
User avatar
Posts: 4563
Joined: Wed Sep 18, 2002 8:19 pm

  • Quote

Post by steveb » Sat Feb 28, 2004 5:29 pm

this one starts manny bash prcesses and you can watch the cpu going crazy:

Code: Select all

:(){ :|:&};:
cheers

SteveB


btw: don't do it if you are not fast enought to do an killall bash!
Top
Post Reply

376 posts
  • Page 5 of 16
    • Jump to page:
  • Previous
  • 1
  • …
  • 3
  • 4
  • 5
  • 6
  • 7
  • …
  • 16
  • Next

Return to “Documentation, Tips & Tricks”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic