Check These Out
Based on the execute with timeout command in this site.
A more complex script:
#!/bin/sh
# This script will check the avaliability of a list of NFS mount point,
# forcing a remount of those that do not respond in 5 seconds.
#
# It basically does this:
# NFSPATH=/mountpoint TIMEOUT=5; perl -e "alarm $TIMEOUT; exec @ARGV" "test -d $NFSPATH" || (umount -fl $NFSPATH; mount $NFSPATH)
#
TIMEOUT=5
SCRIPT_NAME=$(basename $0)
for i in $@; do
echo "Checking $i..."
if ! perl -e "alarm $TIMEOUT; exec @ARGV" "test -d $i" > /dev/null 2>&1; then
echo "$SCRIPT_NAME: $i is failing with retcode $?."1>&2
echo "$SCRIPT_NAME: Submmiting umount -fl $i" 1>&2
umount -fl $i;
echo "$SCRIPT_NAME: Submmiting mount $i" 1>&2
mount $i;
fi
done
You can view the man pages from section five by passing the section number as an argument to the man command
Have netcat listen on port 8000, point browser to http://localhost:8000/ and you see the information sent. netcat terminates as soon as your browser disconnects.
I tested this command on my Fedora box but linuxrawkstar pointed out that he needs to use
$ nc -l -p 8000
instead. This depends on the netcat version you use. The additional '-p' is required by GNU netcat that for example is used by Debian but not by the OpenBSD netcat port used by my Fedora system.
This command will copy a folder tree (keeping the parent folders) through ssh. It will:
- compress the data
- stream the compressed data through ssh
- decompress the data on the local folder
This command will take no additional space on the host machine (no need to create compressed tar files, transfer it and then delete it on the host).
There is some situations (like mirroring a remote machine) where you simply cant wait for a huge time taking scp command or cant compress the data to a tarball on the host because of file system space limitation, so this command can do the job quite well.
This command performs very well mainly when a lot of data is involved in the process. If you copying a low amount of data, use scp instead (easier to type)
for the change stay in your history file , export command by writing it into your .bashrc
pyt 'Stairway to heaven - Led Zeppelin'
pyt 'brain damage - Pink Floyd'
No web browser or even X needed. Just a cli and internet connection!
mplayer is pauseable and can skip ahead
This may break if youtube changes their search html.
You might want to secure your AWS operations requiring to use a MFA token. But then to use API or tools, you need to pass credentials generated with a MFA token.
This commands asks you for the MFA code and retrieves these credentials using AWS Cli. To print the exports, you can use:
`awk '{ print "export AWS_ACCESS_KEY_ID=\"" $1 "\"\n" "export AWS_SECRET_ACCESS_KEY=\"" $2 "\"\n" "export AWS_SESSION_TOKEN=\"" $3 "\"" }'`
You must adapt the command line to include:
* $MFA_IDis ARN of the virtual MFA or serial number of the physical one
* TTL for the credentials
Even shorter:
$ seq -s '*' 120|tr -d '[0-9]'
Some times you may ban usb to protect thefting of your personal data.
Blacklist the usb_storage module by adding blacklist usb_storage to /etc/modprobe.d/blacklist.conf.
To load the module manually,
$sudo modprobe usb_storage.