Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Application Discovery Thread [formerly: app that does this?]
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3 ... , 15, 16, 17  Next  
Reply to topic    Gentoo Forums Forum Index Off the Wall
View previous topic :: View next topic  
Author Message
McLink
Apprentice
Apprentice


Joined: 02 Feb 2008
Posts: 161
Location: /dev/chair

PostPosted: Sat Feb 02, 2008 9:53 am    Post subject: Reply with quote

Glob dot files:
Code:
echo "shopt -s dotglob" >>~/.bashrc
. ~/.bashrc


Bash completion:
Code:
# as root
emerge -uva gentoolkit bash-completion eselect-bashcomp
euse -E bash-completion
emerge -N world
for i in $(eselect --no-colour bashcomp list | tail -n +2 | awk '{print $1}' | sed -e 's/\[//g' -e 's/\]//g'); do eselect bashcomp enable --global $i 2>/dev/null; done
# for both root and user
echo '[[ -f /etc/profile.d/bash-completion ]] && . /etc/profile.d/bash-completion' >>~/.bashrc
. ~/.bashrc


Clearing distfiles older than 3 days:
/etc/cron.daily/cleandistfiles.sh
Code:
#!/bin/bash
while read i
do
        j="/usr/portage/distfiles/${i}"
        if [[ -f "${j}" ]]
        then
                MTIME=$(($(date +%s)-$(stat -c "%Y" "${j}")))
                if [[ "${MTIME}" -ge 259200 ]]
                then
                        rm -f "${j}"
                fi
        fi
done < <(ls -1 --color=never /usr/portage/distfiles)
Back to top
View user's profile Send private message
zixnub
n00b
n00b


Joined: 27 Dec 2007
Posts: 67
Location: Brasschaat, Belgium

PostPosted: Sun Feb 03, 2008 12:03 am    Post subject: Reply with quote

Dralnu wrote:
A new one:

dtach

Mix this with screen (it doesn't play well with screen using it to startup a program, but...), and you've got a rather handy little setup. You can connect a dtach session to multiple terminals, so you might could load them into a screen session, detach it, then attach the same dtach programs to another term, so when you drop out of X, you can go right into a screen session w/o a problem.

Havn't tested it, but it might be worth a shot for people who switch alot.


um... Everything you just described can be done with just screen iirc
Back to top
View user's profile Send private message
Dralnu
Veteran
Veteran


Joined: 24 May 2006
Posts: 1919

PostPosted: Mon Feb 04, 2008 12:56 am    Post subject: Reply with quote

zixnub wrote:
Dralnu wrote:
A new one:

dtach

Mix this with screen (it doesn't play well with screen using it to startup a program, but...), and you've got a rather handy little setup. You can connect a dtach session to multiple terminals, so you might could load them into a screen session, detach it, then attach the same dtach programs to another term, so when you drop out of X, you can go right into a screen session w/o a problem.

Havn't tested it, but it might be worth a shot for people who switch alot.


um... Everything you just described can be done with just screen iirc


Yeah, but if you don't need everything in screen, dtach is a useful either way.
_________________
The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
Back to top
View user's profile Send private message
synss
Apprentice
Apprentice


Joined: 08 Mar 2006
Posts: 282
Location: Dijon > Berlin > Tokyo > Nürnberg > München

PostPosted: Mon Feb 04, 2008 1:15 am    Post subject: Reply with quote

kwalo wrote:

Code:
#!/bin/sh

<snip>

FILE="$(basename $1)-$(date +%F).tar.gz"
[ ! -f "$FILE" ] &&
tar czfv "$FILE" $1



A test: "better safe than sorry" and I never know which is the day today, so I always use 'date +%F' for that kind of things.

cheers
_________________
Compress portage tree
Elog viewer
Autodetect swap
Back to top
View user's profile Send private message
kpoman
Apprentice
Apprentice


Joined: 15 May 2003
Posts: 209
Location: Buenos Aires, Argentina

PostPosted: Mon Feb 04, 2008 9:26 pm    Post subject: Reply with quote

Dralnu wrote:
A new one:

dtach

Mix this with screen (it doesn't play well with screen using it to startup a program, but...), and you've got a rather handy little setup. You can connect a dtach session to multiple terminals, so you might could load them into a screen session, detach it, then attach the same dtach programs to another term, so when you drop out of X, you can go right into a screen session w/o a problem.

Havn't tested it, but it might be worth a shot for people who switch alot.

Another nice one with screen is the -x option !
Sometimes you are helping someone on it's machine distantly, and he wants to learn what you are doing, or even type the root password for you.
So he starts a screen session as a regular user, you start it too as that user, and you do a screen -x its.session, then you are both looking at the same terminal ! He can then see what you are messing there and type the root password for you :)
_________________
please, help me, pity on me :'(
Back to top
View user's profile Send private message
Parasietje
Apprentice
Apprentice


Joined: 25 Jan 2004
Posts: 194

PostPosted: Fri Mar 21, 2008 12:19 pm    Post subject: Reply with quote

Most people use 'emerge -vp package' and then do 'emerge package'. There is an 'emerge -av package' option that shows you what it is about to do, and then asks if it should continue. This only calculates the dependency tree once!

A lot of people do not know that you can use CTRL+R to search through your shell history. This is EXTREMELY useful.

ssh -t forces a terminal to open, even if you are executing a remote command. Ssh -t remoteServer screen -dr MYSCREEN is very useful to immediately attach your screen session.

zsh allows tab-completion for ssh hosts. It reads them from .ssh/known_hosts.

Fluxbox allows you to remember the screen you put programs. This way, your mplayer -fs will always be at the right display.

Mplayer has an option '-fixed-vo'. This will keep the X11 output window. This is very useful if you are watching a lot of video files.

Eclipse 3.3 has an automatic code clean-up function on save. It can save you A LOT of time.

Must-have options for .vimrc:
set nocp
set bg=dark
set ruler

'eix' is faster than 'emerge -s'. Use a dedicated search tool for searching the portage tree.
Back to top
View user's profile Send private message
guruvan
Tux's lil' helper
Tux's lil' helper


Joined: 21 Aug 2007
Posts: 132

PostPosted: Fri Mar 21, 2008 4:20 pm    Post subject: Reply with quote

Here's one I use all the time (from some big 'ol Unix master book from years ago)
Code:
sed 's/[    ][ ]*/ /g'

in the brackets type [CTRL-V TAB][Space]
This removes all but a single space character from any input
I use it mostly so that I can use a space as a field delimter for cut
Code:
# df  | sed 's/[    ][ ]*/ /g'  | grep -v Filesystem | cut -d" " -f4


=============

Tip of the week: use ionice along with nice to do taxing jobs more in the background.......at home I like my desktop to be snappy while I cp huge stuff, zip and compile. On production machines a big cp job can easily tax the box to the point of support calls coming in.

============
Never play leapfrog with a unicorn
_________________
Everything is broken......(b.dylan). 8)

guruvan
Back to top
View user's profile Send private message
darkphader
Veteran
Veteran


Joined: 09 May 2002
Posts: 1158
Location: Motown

PostPosted: Fri Mar 21, 2008 6:56 pm    Post subject: find all updates Reply with quote

I was looking for a way to find all possible package updates as normally even an emerge -uDp world will not show them all to you because not everything is in your world file (normally). There may be a simple easy command that I'm missing but I haven't found it yet so I wrote this little script:
Code:
#!/bin/bash
qlist -I >/root/fullworld #create list of all installed packages
if [ /var/lib/portage/world ] ; then
        cp -f /var/lib/portage/world /var/lib/portage/normworld #backup world file
fi
cp -f /root/fullworld /var/lib/portage/world #replace world file with full list
emerge -uDp world | grep 'U ]' #show available updates - edit the emerge command or edit/remove the grep to see other info
cp -f /var/lib/portage/normworld /var/lib/portage/world #replace world with the saved backup
rm /var/lib/portage/normworld #remove world backup
rm /root/fullworld #remove list of all packages created above

You need to have app-portage/portage-utils installed and the script must run as root (unless you give your user permissions to write in /var/lib/portage, and you'll need to modify the script then as well). Also not a bad idea to save a backup copy of your world file just in case.

If there is a simple portage command that does this please let me know, I will accept the egg on my face gracefully :)

Chris

PS. I call the file "findupdates", place it in /usr/local/bin , "chown root" and "chmod 744"

Also, please note that the emerge command in the script has the pretend flag set - it will not do anything (start any emerge, etc.) other than display the info in the terminal window.
_________________
A mouse is a device used to point at the xterm you want to type in.
Back to top
View user's profile Send private message
Dralnu
Veteran
Veteran


Joined: 24 May 2006
Posts: 1919

PostPosted: Fri Mar 21, 2008 11:42 pm    Post subject: Re: find all updates Reply with quote

darkphader wrote:
I was looking for a way to find all possible package updates as normally even an emerge -uDp world will not show them all to you because not everything is in your world file (normally). There may be a simple easy command that I'm missing but I haven't found it yet so I wrote this little script:
Code:
#!/bin/bash
qlist -I >/root/fullworld #create list of all installed packages
if [ /var/lib/portage/world ] ; then
        cp -f /var/lib/portage/world /var/lib/portage/normworld #backup world file
fi
cp -f /root/fullworld /var/lib/portage/world #replace world file with full list
emerge -uDp world | grep 'U ]' #show available updates - edit the emerge command or edit/remove the grep to see other info
cp -f /var/lib/portage/normworld /var/lib/portage/world #replace world with the saved backup
rm /var/lib/portage/normworld #remove world backup
rm /root/fullworld #remove list of all packages created above

You need to have app-portage/portage-utils installed and the script must run as root (unless you give your user permissions to write in /var/lib/portage, and you'll need to modify the script then as well). Also not a bad idea to save a backup copy of your world file just in case.

If there is a simple portage command that does this please let me know, I will accept the egg on my face gracefully :)

Chris

PS. I call the file "findupdates", place it in /usr/local/bin , "chown root" and "chmod 744"

Also, please note that the emerge command in the script has the pretend flag set - it will not do anything (start any emerge, etc.) other than display the info in the terminal window.


Hmm, are you looking for --deep, which looks for all upgrades.
_________________
The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
Back to top
View user's profile Send private message
steveL
Advocate
Advocate


Joined: 13 Sep 2006
Posts: 4787
Location: The Peanut Gallery

PostPosted: Sat Mar 22, 2008 1:30 pm    Post subject: Reply with quote

Well here's my favourite tips topmost of which should be use update! ;p (pre-release on last page)
_________________
creaker wrote:
systemd. It is a really ass pain

update - "a most excellent portage wrapper"

#friendly-coders -- We're still here for you™ ;)
Back to top
View user's profile Send private message
darkphader
Veteran
Veteran


Joined: 09 May 2002
Posts: 1158
Location: Motown

PostPosted: Sun Mar 23, 2008 4:47 am    Post subject: Re: find all updates Reply with quote

Dralnu wrote:
Hmm, are you looking for --deep, which looks for all upgrades.

No, that's the same as "D" in my example above. It may look for all upgrades but it certainly doesn't find them. Only by populating the world file with all installed packages (which I do temporarily) will an "emerge -u" find them all.
_________________
A mouse is a device used to point at the xterm you want to type in.
Back to top
View user's profile Send private message
steveL
Advocate
Advocate


Joined: 13 Sep 2006
Posts: 4787
Location: The Peanut Gallery

PostPosted: Mon Mar 24, 2008 12:38 pm    Post subject: Re: find all updates Reply with quote

darkphader wrote:
Dralnu wrote:
Hmm, are you looking for --deep, which looks for all upgrades.

No, that's the same as "D" in my example above. It may look for all upgrades but it certainly doesn't find them. Only by populating the world file with all installed packages (which I do temporarily) will an "emerge -u" find them all.

You should really be using emerge -p --depclean occasionally; if something's been merged but isn't in world, nor a dep of something in world, you should be able to get rid of it without affecting your system. Those are the "hidden" upgrades you're talking about; usually old dependencies which aren't needed anymore, perhaps because the package using them has gone, or no longer needs it. Note that you should use -p and check to see if stuff is going you want to keep. You can put those in world with emerge --noreplace cat/pkg and then run the depclean with -a.
Back to top
View user's profile Send private message
darkphader
Veteran
Veteran


Joined: 09 May 2002
Posts: 1158
Location: Motown

PostPosted: Mon Mar 24, 2008 7:29 pm    Post subject: Re: find all updates Reply with quote

steveL wrote:
You should really be using emerge -p --depclean occasionally; if something's been merged but isn't in world, nor a dep of something in world, you should be able to get rid of it without affecting your system.

Well --depclean lists a lot of packages (143) and virtually everyone has some dependencies, with a hit ratio so poor it seems like a waste of time to go through everyone of them. Even some of the "hidden upgrades" had dependencies when I checked.
_________________
A mouse is a device used to point at the xterm you want to type in.
Back to top
View user's profile Send private message
Dralnu
Veteran
Veteran


Joined: 24 May 2006
Posts: 1919

PostPosted: Wed Mar 26, 2008 2:40 am    Post subject: Reply with quote

If you go through and install/uninstall alot of programs, you will aquire alot of loose packages in your system you don't need. If --depclean is trying to remove a needed package, you might want to file a bugreport.
_________________
The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
Back to top
View user's profile Send private message
steveL
Advocate
Advocate


Joined: 13 Sep 2006
Posts: 4787
Location: The Peanut Gallery

PostPosted: Wed Mar 26, 2008 2:46 pm    Post subject: Re: find all updates Reply with quote

darkphader wrote:
Well --depclean lists a lot of packages (143) and virtually everyone has some dependencies, with a hit ratio so poor it seems like a waste of time to go through everyone of them. Even some of the "hidden upgrades" had dependencies when I checked.

That's the point though; those packages aren't in world so have most likely come in as dependencies (pulling in other stuff.) If you want to keep them, emerge --noreplace. If not, why not just let portage get rid of them for you?
Back to top
View user's profile Send private message
darkphader
Veteran
Veteran


Joined: 09 May 2002
Posts: 1158
Location: Motown

PostPosted: Wed Mar 26, 2008 3:07 pm    Post subject: Reply with quote

Here's a couple of --depclean examples, besides the other 140+ packages it wants to unmerge dev-db/unixODBC and media-sound/shorten:
Code:
equery d media-sound/shorten
[ Searching for packages depending on media-sound/shorten... ]
media-sound/shntool-3.0.7 (shorten? media-sound/shorten)

Code:
equery d dev-db/unixODBC
[ Searching for packages depending on dev-db/unixODBC... ]
dev-java/blackdown-jdk-1.4.2.03-r16 (odbc? dev-db/unixODBC)
dev-java/sun-jdk-1.6.0.04 (odbc? dev-db/unixODBC)
net-nds/openldap-2.3.41 (!minimal & odbc? dev-db/unixODBC)
x11-libs/qt-4.3.4-r1 (odbc? dev-db/unixODBC)
x11-libs/wxGTK-2.6.4.0-r3 (odbc? dev-db/unixODBC)
x11-libs/wxGTK-2.8.7.1-r1 (odbc? dev-db/unixODBC)

Will I find some without dependencies? Yes, but --depclean should be a lot smarter to eliminate all of the manual work of querying 140+ packages by hand. And yes, media-sound/shntool is in the world file.
I guess I've read too many horror stories in the past when if allowed to act unencumbered it removes something critical like python. Otherwise I would let it go ahead then do a revdep-rebuild, but I don't trust it and the evidence above hints that maybe it still shouldn't be trusted.
_________________
A mouse is a device used to point at the xterm you want to type in.
Back to top
View user's profile Send private message
zmedico
Developer
Developer


Joined: 02 Jan 2004
Posts: 310
Location: California USA

PostPosted: Wed Mar 26, 2008 8:40 pm    Post subject: Reply with quote

darkphader wrote:
Yes, but --depclean should be a lot smarter to eliminate all of the manual work of querying 140+ packages by hand.


--depclean works relatively well with current versions of portage (be sure to run revdep-rebuild afterwards). You seem to be confused by conditional dependencies.

Code:
cat /var/db/pkg/media-sound/shntool-3.0.7/USE


If you don't see "shorten" in those USE flags then the media-sound/shorten dependency is canceled out. The dev-db/unixODBC dependency is an analogous situation. If none of those packages have "odbc" in USE then the dependency is canceled out. USE is frozen at build time, so you'd have to rebuild those packages with USE="odbc" enabled if you want them to pull in dev-db/unixODBC as a dependency.
_________________
Zac
Back to top
View user's profile Send private message
David Serrano
n00b
n00b


Joined: 26 Mar 2008
Posts: 16

PostPosted: Wed Mar 26, 2008 11:34 pm    Post subject: Re: My fav, very helpful Reply with quote

tallest wrote:
Code:
alias dum='du -h --max-depth=1'


I use:

Code:
du -s * | sort -rn


Although I haven't aliased it (yet). Oh, and I don't like that -h(uman) switch because it makes it harder to spot the biggest file (a frequent situation); for example:

80
104
630080
6568
10916
3572
256
135752
336

vs

80K
104K
616M
6.5M
11M
3.5M
256K
133M
336K
_________________
David Serrano
Back to top
View user's profile Send private message
David Serrano
n00b
n00b


Joined: 26 Mar 2008
Posts: 16

PostPosted: Wed Mar 26, 2008 11:55 pm    Post subject: Reply with quote

I have the following bits for my $PS1:

Code:
function num_path_components() {
    local -a ARRAY
    CONCAT="$*"
    IFS=/ read -a ARRAY <<< "${CONCAT#/}"
    echo ${#ARRAY[*]}
}

export HUE_PATH_ELEMS=3
export PS1='\
... stuff ...
$(
    if [[ $PWD == / ]]; then  ## workaround to avoid empty resulting output
        echo $PWD
    else
        LEN=$(num_path_components $PWD)
        LEN_HOME=$(num_path_components $HOME)
        STRIPPED_ELEMS=$(( $LEN - $HUE_PATH_ELEMS ))

        ## if we are under $HOME and the number of stripped elements is
        ## less than or equal to the size of $HOME, then we are stripping
        ## part of $HOME, or the whole $HOME but not anything more, so we
        ## can return a tilde-compressed $PWD in order to obtain a fully
        ## qualified path. As a bonus, most of the time this will yield a
        ## shorter result.
        ##
        ## BUG: when $HOME == /, the result lacks a slash after the tilde.
        ## Since users having / as $HOME should not have a fancy $PS1, this
        ## does not matter much.
        if [[ $PWD =~ ^$HOME && $STRIPPED_ELEMS -le $LEN_HOME ]]; then
            echo ${PWD/#$HOME/\~}
        else
            RESULT=
            IFS=/ read -a ELEMS <<< "${PWD#/}"

            for ((I=$LEN-1, J=HUE_PATH_ELEMS-1; I>=0 && J>=0; I--, J--)); do
                RESULT="/${ELEMS[$I]}$RESULT"
            done

            ## add leading slash if the resulting path is (almost) fully qualified
            [[ $HUE_PATH_ELEMS -lt $LEN ]] && RESULT=${RESULT#/}
            echo ${RESULT/#$HOME/\~}
        fi
    fi
) \
... more stuff ...'


By setting $HUE_PATH_ELEMS you can control the length of the prompt:

Code:
hue@hue ~ $ cd /usr/src/linux-2.6.18.1-amd64/drivers/media/common/
hue@hue drivers/media/common $ export HUE_PATH_ELEMS=1
hue@hue common $ export HUE_PATH_ELEMS=2
hue@hue media/common $ cd ~/em/gspca
hue@hue ~/em/gspca $ _


Notice how, despite showing only 2 path elements, the last directory appears as "fully qualified" because the price is so low (just the two characters "~/"). It has the plus of not calling any external program (in fact that's a property of my full $PS1).
_________________
David Serrano
Back to top
View user's profile Send private message
David Serrano
n00b
n00b


Joined: 26 Mar 2008
Posts: 16

PostPosted: Thu Mar 27, 2008 12:06 am    Post subject: Reply with quote

DangerDan wrote:
less !$

result:

less /usr/src/linux/README


And if what you wanted to use was /usr/src/linux/README.gz, you could do this:

Code:
shopt -s histverify


Now, when using history expansion, you'll have the chance of editing the expanded command line:

Code:
$ echo foo       ## press enter and the command will run
foo
$ echo !$        ## press enter and...
$ echo foo       ## ...a new, expanded prompt appears. Enter again to run


You can even combine this with {,} and other bash features:

Code:
$ touch foo
$ mv !${,.bak}
$ mv foo{,.bak}   ## expanded, not actually typed, prompt
$ ls foo*
foo.bak
$ _

_________________
David Serrano
Back to top
View user's profile Send private message
seqizz
Tux's lil' helper
Tux's lil' helper


Joined: 14 Jan 2008
Posts: 103

PostPosted: Thu Mar 27, 2008 3:15 pm    Post subject: :\ Reply with quote

From another topic, i've tried & love..

re-emerge mozilla-firefox with "moznopango" flag.. just faster, at least for me :)

And also this, clear swap memory (can be risky but i'm using)

Code:
echo -e "noutput of free before:" &&
free &&
swapoff -a && swapon -a &&   

echo -e "noutput of free after:" &&
free &&
echo -e ""

_________________
what about an answer here?
Back to top
View user's profile Send private message
easy target
Tux's lil' helper
Tux's lil' helper


Joined: 09 Jan 2008
Posts: 134

PostPosted: Thu Mar 27, 2008 4:32 pm    Post subject: Reply with quote

Hi.

Is there an easy way (or a program) to strip console escape codes from files/stdin (like remove colors from emerge log)? (I know I can use 'emerge --color n' for portage.)
Back to top
View user's profile Send private message
Dralnu
Veteran
Veteran


Joined: 24 May 2006
Posts: 1919

PostPosted: Mon Apr 21, 2008 1:01 am    Post subject: Reply with quote

An app, similar to xpad, but a bit more configurable, and not as ugly, but doesn't require a DE.
_________________
The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
Back to top
View user's profile Send private message
McLink
Apprentice
Apprentice


Joined: 02 Feb 2008
Posts: 161
Location: /dev/chair

PostPosted: Mon Apr 21, 2008 5:15 am    Post subject: Reply with quote

I'm looking for a floating WM with mouse support that integrates nicely with GNOME, has features (i.e. not Metacity), and has some decent themes available (it would be nice, though by no means a necessity, if it could use Metacity themes). Other than having good themes, Metacity is shit, and I've been looking for something capable of replacing it for quite a while now. I'm considering e17, but I'm not sure how nicely it plays with GNOME (or, perhaps more accurately, how nicely GNOME plays with e17).
_________________
Mc'abit wrote:
Islam isn't the problem, religion is.
Back to top
View user's profile Send private message
zixnub
n00b
n00b


Joined: 27 Dec 2007
Posts: 67
Location: Brasschaat, Belgium

PostPosted: Mon Apr 21, 2008 12:23 pm    Post subject: Reply with quote

Sir Link wrote:
I'm looking for a floating WM with mouse support that integrates nicely with GNOME, has features (i.e. not Metacity), and has some decent themes available (it would be nice, though by no means a necessity, if it could use Metacity themes). Other than having good themes, Metacity is shit, and I've been looking for something capable of replacing it for quite a while now. I'm considering e17, but I'm not sure how nicely it plays with GNOME (or, perhaps more accurately, how nicely GNOME plays with e17).

e16? :P
_________________
https://github.com/Zubnix/jaccall
https://github.com/Zubnix/wayland-java-bindings
https://github.com/Zubnix/westford
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Off the Wall All times are GMT
Goto page Previous  1, 2, 3 ... , 15, 16, 17  Next
Page 16 of 17

 
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