your linux toolbox online

Every linux system administrator has a toolbox of one liners. Sometimes you forget something or you need something new.

Submit your one liners here and have them always at hand. And share them with others at the same time.

logged in users get less adds and a search function.

find all files with read write permissions for owner only and show permissions

find all files with read write permissions for owner only and show permissions

find -perm "permissions"

. start in current dir

- exec = execute following command

find . -perm 600 -exec ls -l {} \;

find exec missing argument:

if you get the missing argument error, be sure to use the space \;

the \ escape is not always needed (depends on shell)

Create encrypted passwords dovecotpw

dovecotpw -u username -s encryptiontype

get a list of possible encryption schemes

dovecotpw -l

CRYPT MD5 MD5-CRYPT SHA SHA1 SHA256 SMD5 SSHA PLAIN CLEARTEXT CRAM-MD5 HMAC-MD5 DIGEST-MD5 PLAIN-MD4 PLAIN-MD5 LDAP-MD5 LANMAN NTLM OTP SKEY RPA

encrypted passwords for use with dovecot

show hardware information on running system

$dmidecode

or
$sudo dmidecode

use dmidecode --type

to get specific info

dmidecode --type memory

create a directory with different permissions

create a directory with different permissions. Use -m extension.

mkdir /home/test -m 1666

numeric permission as you like without chmod

answer yes to all questions asked by program

sometimes a program asks a lot of questions, and you know you want to answer all with yes.

if there are 200 questions it'll take a while. Pipe the output of the yes command to your program to automatically answer yes to all questions:

$yes | rm -I *

this particular example is of no use, but demonstrates it's function. rm -I * removes all contents of current directory interactively (asking if your sure)
sometimes rm is an alias for rm -I but even then you can just use rm -f (force)

There are many cases where the yes command could be of use.

capture video of your desktop

xvidcap --file filename.mpeg --fps 15 --cap_geometry 1680x1050+0+0 --rescale 25 --time 200.0 --start_no 0 --continue yes --gui no --auto

needs xvidcap (obviously)

create ssh keys

ssh-keygen

copy ssh keys to remote host

ssh-copy-id user@host

open all files in current dir containing pattern in vi

vi $(grep -l 'pattern' *)