Home > Linux > My Linux Tricks (always growing)

My Linux Tricks (always growing)

Here are a few little tricks I’ve used in the past that might be helpful. I use some of them often and others only on occasion and wanted a good reference for if I forgot what it was (an example was setting up a new webdev env and forgot about the g+s part).

Add/Remove a secondary group from a user with out having to copy the whole group list they have assigned to them.

$ gpasswd -a <USER> <GROUP>
$ gpasswd -d <USER> <GROUP>

Set VIM as the default ubuntu editor instead of NANO, this drives me nuts if they change it from vi they should have a prompt at install for which editor. Making NANO the default/recommended but allow others to select one they prefer.

$ sudo apt-get install vim
$ sudo update-alternatives --config editor

A nice little password safe encryption program. xdotools is required if you want it to use auto fill other wise it can be skipped.

$ sudo <System Package Manager> install keepass2
$ sudo <System Package Manager> install xdotool

Surprisingly the sshd didn’t get installed by default with my Ubuntu system. Of course it’s a desktop OS.

$ sudo apt-get install openssh-server

A simple way to watch a directory for any new files created.

$ sudo <System Package Manager> install inotify-tools

Good old Conky for system information.

$ sudo <System Package Manager> install conky

Set all subdirectories to have the setgui bit. The following assumes your current directories is the one you want want all subdirectories to be changed. Just change the path to the directory you want if you’re not currently in it. The setuid/setgui/sticky bits are the “1st” octet of the permissions and numbered 4/2/1 respectively . So g+s would make a 775 file become 2775.

For more information read the chmod man page sections SETUID AND SETGID BITS and RESTRICTED DELETION FLAG OR STICKY BIT.

The stats command shows the octet code of each file in the current directory. I prefer octet codes just because it’s easier for me other wise you can just do an ls -l and you’ll see the file with -rwxrwxr-x will become -rwxrwsr-x.

$ find . -type d -exec chmod g+s {} \;
$ stat -c "%a %n" *

Nice way to tail multiple files in a single console.

$ sudo <System Package Manager> install multitail

Have a terminal always running in the background on your desktop with devilspie.

$ sudo <System Package Manager> install devilspie
$ mkdir ~/.devilspie
## geometry is made of up window size (x1,y1) position(x2,y2) x1+y1+x2+y2
$ vim ~/.devilspie/desktopTerm.ds
        ( if
        ( matches ( window_name ) "desktopTerm" )
        ( begin
        ( set_workspace 1 )
        ( pin )
        ( skip_pager )
        ( skip_tasklist )
        ( undecorate )
        ( below )
        ( geometry "700x1090+1240+0" )
## Make devilspie starts up the -a option has it apply the rules to all  existing windows 
devilspie -a
## I am setting this up with Xubuntu so my desktop is XFCE4 and it's terminal
## -T sets the title of the terminal so devilspie can target it.
xfce4-terminal -T desktopTerm
Categories: Linux
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: