Simple one-liner $>python -c ‘import hashlib; print hashlib.sha512(“1234123123”).hexdigest(); ‘ can be easily packaged in a bash script. nJoy;-)
Tag: Bash
Screen script for multi-user session or reminding you to create a screen on logon
A common problem when many people share large systems as the same user ( I know .. I know but anyways move on ) is that when you logon you might want to take over where someone else left off. Also sometimes you want to share a session with someone for supervision or just team…
Bash While Loop Example
How do I use bash while loop to repeat certain task under Linux / UNIX operating system? How do I set infinite loops using while statement? The bash while loop is a control flow statement that allows code or commands to be executed repeatedly based on a given condition. For example, run echo command 5…
Close ssh and leave a job running
Using the Job Control of bash to send the process into the background: ctrl+z to stop (pause) the program and get back to the shell bg to run it in the background disown -h so that the process isn’t killed when the terminal closes nJoy! 😉
Reset Mysql password from bash prompt
You can recover MySQL database server password with following five easy steps. Step # 1: Stop the MySQL server process. Step # 2: Start the MySQL (mysqld) server/daemon process with the –skip-grant-tables option so that it will not prompt for password. Step # 3: Connect to mysql server as the root user. Step # 4:…
Move files with progress and bandwith limit
rsync –progress -ah –remove-sent-files –bwlimit=1000 source/ /target nJoy 🙂
One Liner to test php sending mail from a bash script
To check if your php installation can successfully send emails from a bash script try this : php -r ‘var_dump(mail(“david.saliba@testemail.com”, “test subject”, “test body”));’ Thanks Gareth ! nJoy 🙂 !
Test if memcache is installed in php from bash line
php -i | grep -i memcache Short and sweet sample output : memcache memcache support => enabled memcache.allow_failover => 1 => 1 memcache.chunk_size => 8192 => 8192 memcache.default_port => 11211 => 11211 memcache.default_timeout_ms => 1000 => 1000 memcache.hash_function => crc32 => crc32 memcache.hash_strategy => standard => standard memcache.max_failover_attempts => 20 => 20 memcached memcached support…
Using Expect to automate an scp filetransfer
Sometimes you know passwords but are not ion a position to use shared keys. Solution is using expect to pass the password from a script read or a comman line parameter. ** NOTE Passwords in command lines are a really bad idea since you can see them in the history / ps -ef so best…
Take picture from webcam using linux command line (bash)
From bash it’s easy to snap a photo from the webcam. mplayer -vo png -frames 1 tv:// That’s it.. Njoy 🙂