Check These Out
Shows all block devices in a tree with descruptions of what they are.
Replace 'csv_file.csv' with your filename.
You can use wildcard with rpm search but you have to do 2 things:
1. use "-a" switch (means "all") with query ("-q") switch - argument is a pattern to use while searching for package names of all installed packages
2. protect wildcards, so that shell could not eat them - escape it with backslash ("\") or enclose all pattern between apostrophes ("'"):
$ rpm -qa 'co*de'
As you can see above it is possible to insert wildcards into middle of the pattern.
If you want, you can add "-i" or another rpm query options, "-i" will print package information for all installed packages matching pattern.
$ time perl -e 'if(opendir D,"."){@a=readdir D;print $#a - 1,"\n"}'
205413
real 0m0.497s
user 0m0.220s
sys 0m0.268s
$ time { ls |wc -l; }
205413
real 0m3.776s
user 0m3.340s
sys 0m0.424s
*********
** EDIT: turns out this perl liner is mostly masturbation. this is slightly faster:
$ find . -maxdepth 1 | wc -l
sh-3.2$ time { find . -maxdepth 1|wc -l; }
205414
real 0m0.456s
user 0m0.116s
sys 0m0.328s
** EDIT: now a slightly faster perl version
$ perl -e 'if(opendir D,"."){++$c foreach readdir D}print $c-1,"\n"'
sh-3.2$ time perl -e 'if(opendir D,"."){++$c foreach readdir D}print $c-1,"\n"'
205414
real 0m0.415s
user 0m0.176s
sys 0m0.232s
You need python-scapy package
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"
I often use it to find recently added ou removed device, or using find in /dev, or anything similar.
Just run the command, plug the device, and wait to see him and only him
A wrapper around ssh to automatically provide logging and session handling.
This function runs ssh, which runs screen, which runs script.
.
The logs and the screen session are stored on the server.
This means you can leave a session running and re-attach to it later, or from another machine.
.
.
Requirements:
* Log sessions on a remote server
* Transparent - nothing extra to type
* No installation - nothing to copy to the server beforehand
.
Features:
* Function wrapper delegating to ssh
- so nothing to remember
- uses .ssh/config as expected
- passes your command line option to ssh
* Self-contained: no scripts to install on the server
* Uses screen(1), so is:
- detachable
- re-attachable
- shareable
* Records session using script(1)
* Configurable log file location, which may contain variables or whitespace
L="$HOME" # local variable
L="\$HOME" # server variable
L="some space"
.
Limitations:
* Log dir/file may not contain '~' (which would require eval on the server)
.
.
The sessions are named by the local user connecting to the server.
Therefore if you detach and re-run the same command you will reconnect to your original session.
If you want to connect/share another's session simply run:
$ USER=bob ssh root@server
.
The command above is stripped down to an absolute minimum.
A fully expanded and annotated version is available as a Gist (git pastebin):
https://gist.github.com/flatcap/3c42326abeb1197ee714
.
If you want to add timing info to script, change the command to:
$ ssh(){ L="\$HOME/logs/$(date +%F_%H:%M)-$USER";/usr/bin/ssh -t "$@" "mkdir -p \"${L%/*}\";screen -xRRS $USER script --timing=\"$L-timing\" -f \"$L\"";}