Tips and Tricks: Difference between revisions

From Q
Jump to navigation Jump to search
Tgurr (talk | contribs)
No edit summary
Tgurr (talk | contribs)
No edit summary
Line 47: Line 47:
=== MultiSSH ===
=== MultiSSH ===
Connect to multiple hosts via SSH and open/name a new Yakuake tab for each
Connect to multiple hosts via SSH and open/name a new Yakuake tab for each
multissh.sh
multissh.sh
<source lang="bash">
<source lang="bash">
Line 69: Line 70:
=== MultiCommand ===
=== MultiCommand ===
Run a command in multiple open Yakuake tabs
Run a command in multiple open Yakuake tabs
multicommand.sh
multicommand.sh
<source lang="bash">
<source lang="bash">
Line 92: Line 94:
</source>
</source>


== KDE4 Fixes ==
== KDE4 problems and workarounds ==
=== .gtkrc isn't honoured by GTK Applications anymore ===
=== ~/.gtkrc-2.0 doesn't affect GTK applications anymore ===
KDE overrides the GTK colours with global ones, if you want that. If not (since it also overrides the GTK theme with the ugly default one) you can disable that behaviour under System Settings -> Appearance -> Colors at the bottom. This does not always work, so copy over your .gtkrc-2.0 from your homedir or one of the themes that come with the theme pack.
KDE overrides the gtkrc with it's own, if you want that. You can disable that behaviour under System Settings -> Appearance -> Colors at the bottom. However this currently does not work, so copy over your .gtkrc-2.0 from your homedir or one from the themes that come with the gtk-engines package.


{{Codeline|# cp ~/.gtkrc-2.0 ~/.kde/share/config/gtkrc-2.0}}
{{Codeline|# cp ~/.gtkrc-2.0 ~/.kde/share/config/gtkrc-2.0}}


{{Codeline|# cp /usr/share/themes/Clearlooks/gtk-2.0/gtkrc ~/.gtkrc-2.0}}
{{Codeline|# cp /usr/share/themes/Clearlooks/gtk-2.0/gtkrc ~/.kde/share/config/gtkrc-2.0}}


For more information have a look at [[GTK_Anwendungen_unter_KDE|GTK Applications under KDE]].
For more information have a look at [[GTK_Anwendungen_unter_KDE|GTK Applications under KDE]].


=== Reset to the default Plasma layout ===
=== Reset to the default Plasma layout ===
Log out and deleting from tty:
Log out of KDE/X and delete from tty:


{{Codeline|# rm ~/.kde/share/config/plasma*}}
{{Codeline|# rm ~/.kde/share/config/plasma*}}

Revision as of 23:22, 26 April 2008

Package management

To which package belongs file X

# equery belongs -f <dateiname>

Which packages has USE-Flag X

# equery hasuse <useflag>

Backup an installed package

# quickpkg net-www/apache

After this you can install the package on another machine or do a fast downgrade if something went bad after an update. You can find the file under Template:Filename and in this example a symlink to the apache file in Template:Filename. To install the now precompiled binary use:

# emerge --usepkgonly "<net-www/apache-2.2.4"

Detect and get rid of leftover packages

# emerge depclean --pretend

Change your current profile

# emerge eselect

# eselect profile list

# eselect profile set <nummer>

SCP file transfer

File transfer via commandline.

Upload file:
# scp /root/htdocsbackup.tar.bz2 root@remote-host.de:/root/
Download file:
# scp root@remote-host.de:/root/htdocsbackup.tar.bz2 /root/htdocsbackup.tar.bz2

Upload directory:
# scp -r /root/directory root@remote-host.de:/root
Download directory:
# scp -r root@remote-host.de:/root/directory /root

SSH tunnel

Very useful if the server you want to connect to has only the SSH port open and/or a firewall infront and you want to access for example a tomcat server running on port 8080.

# ssh -N -i /home/<user>/.ssh/id_dsa -L 7777:remote-host.de:8080 root@remote-host.de

After establishing the tunnel you can access the tomcat server of the remote machine port 8080 at your localhost port 7777.

Yakuake DCOP scripts

MultiSSH

Connect to multiple hosts via SSH and open/name a new Yakuake tab for each

multissh.sh

#!/bin/bash

[[ -n "$1" && -n "$2" ]] || {
    echo "Usage: ./multissh.sh \"user\" \"server1 server2\""
    echo " z.B.: ./multissh.sh \"root\" \"server1 server2\""; exit 0 ; }

lastid=`dcop yakuake DCOPInterface sessionIdList | awk -F, '{print $NF}'`

for i in $2 ; do
        dcop yakuake DCOPInterface slotAddSession
        let "lastid += 1"
        dcop yakuake DCOPInterface slotRenameSession $lastid $i
        dcop yakuake DCOPInterface slotRunCommandInSession $lastid "ssh $1@$i"
done

exit 0

MultiCommand

Run a command in multiple open Yakuake tabs

multicommand.sh

#!/bin/bash

[[ -n "$1" && -n "$2" ]] || {
    echo "Usage: ./multicommand.sh \"tabname1 tabname2\" \"command\""
    echo " z.B.: ./multicommand.sh \"server1 server2\" \"emerge --sync\""; exit 0 ; }

ids=`dcop yakuake DCOPInterface sessionIdList | sed 's/,/ /g'`

for i in $ids ; do
        sessionname=`dcop yakuake DCOPInterface slotSessionName $i`

        for x in $* ; do
                if [ "$sessionname" = "$x" ] ; then
                        dcop yakuake DCOPInterface slotRunCommandInSession $i "$2"
                fi
        done
done

exit 0

KDE4 problems and workarounds

~/.gtkrc-2.0 doesn't affect GTK applications anymore

KDE overrides the gtkrc with it's own, if you want that. You can disable that behaviour under System Settings -> Appearance -> Colors at the bottom. However this currently does not work, so copy over your .gtkrc-2.0 from your homedir or one from the themes that come with the gtk-engines package.

# cp ~/.gtkrc-2.0 ~/.kde/share/config/gtkrc-2.0

# cp /usr/share/themes/Clearlooks/gtk-2.0/gtkrc ~/.kde/share/config/gtkrc-2.0

For more information have a look at GTK Applications under KDE.

Reset to the default Plasma layout

Log out of KDE/X and delete from tty:

# rm ~/.kde/share/config/plasma*

Change the Dolphin standard view to detailed view for ALL folders

Open Dolphin -> Settings > Configure Dolphin -> Views -> Common Tab -> and mark -> Use the same view for all folders