Before: :key => 'value' After: key: 'value' I have only tested this a little, so please don't run this on anything important unless you have version control or other backups!
Replace "APIKEY" with your public apikey Show Sample Output
change the path where you are, when is executed, is usefule when you've got folders to classify something like a tags, you've got devel/dist, android/ios, etc. like: ~user/Documents/devel/project ~user/Documents/dist/project You can change between devel/project folder to dist/project without leave project. If somebody has a better idea to do that without replace command. Show Sample Output
Calculate the date of Sysadmin day (last Friday of July) of any given year Show Sample Output
Similar to the following:
curl -I <URL>
but curl -I performs a HEAD request, which can yield different results.
Thx Mass1 for the sharing
Works great on Mac OSX.
When booting a VM through OpenStack and managed through cloudinit, the hosts file gets to write a line simiar to 127.0.1.1 ns0.novalocal ns0 This command proven useful while installing a configuration manager such as Salt Stack (or Puppet, or Ansible) and getting node name
This sed command will search for 4.2.2.2 in all lines of test.txt and replace comment symbol ";" . You can use it for other purpose also.
Google Cloud SDK comes with a package manager `gcloud components` but it needs a bit of `sed` to work. Modify the "^| Not" bit to change the package selection. (The gcloud --format option is currently broken) Show Sample Output
List all fonts used by an SVG file. Useful to find out which fonts you need to have installed in order to open/edit an SVG file appropriately. Show Sample Output
Use sed to search and replace pipes for tabs in file stream with backup
Refactored the original. Cuts out the unnecessary grep and echo. Sample output shows that you get multiple results if you have multiple displays, each presented as 'landscape' whether the display is in fact in landscape or portrait orientation. In the sample case, 1920x1200 is misleading, since it's really in portrait mode, 1200x1920. Show Sample Output
This will look in all binary and library files in package and then search the system for this library and then print the required package that has this file, this depends on /etc/prt-get.conf prtdir order. finddeps is a prt-utils script for http://crux.nu/ CRUX Linux. If you use docker you can try this out with "docker run -i -t crux" Show Sample Output
Get you IPV 6 address with curl and sed. Show Sample Output
In the field, I needed to script a process to scan a specific vendor devices in the network. With the help of nmap, I got all the devices of that particular vendor, and started a scripted netcat session to download configuration files from a tftp server. This is the nmap loop (part of the script). You can however, add another pipe with grep to filter the vendor/manufacturer devices only. If want to check the whole script, check in http://pastebin.com/ju7h4Xf4 Show Sample Output
1. There is no use of '--color=auto' in front of a pipe--instead with '--color=always' grep will mark the section headings. 2. I suppose the use of grep with '-A 900' or '-B 900' respectively a 'dirty trick'--sed can do 'exactly' what we want, however, grep does the nice colouring (see 1.) 3. Cutting of the tail (everthing starting with 'Weitere Aktionen') first leads to no output if leo doesn't no the translation. Show Sample Output
This is much easier to parse and do something else with (eg: automagically create ZFS vols) than anything else I've found. It also helps me keep track of which disks are which, for example, when I want to replace a disk, or image headers in different scenarios. Being able to match a disk to the kernels mapping of said drive the disks serial number is very helpful
ls -l /dev/disk/by-id
Normal `ls` command to list contents of /dev/disk/by-id
grep -v "wwn-"
Perform an inverse search - that is, only output non-matches to the pattern 'wwn-'
egrep "[a-zA-Z]{3}$"
A regex grep, looking for three letters and the end of a line (to filter out fluff)
sed 's/\.\.\/\.\.\///'
Utilize sed (stream editor) to remove all occurrences of "../../"
sed -E 's/.*[0-9]{2}:[0-9]{2}\s//'
Strip out all user and permission fluff. The -E option lets us use extended (modern) regex notation (larger control set)
sed -E 's/->\ //'
Strip out ascii arrows "-> "
sort -k2
Sort the resulting information alphabetically, on column 2 (the disk letters)
awk '{print $2,$1}'
Swap the order of the columns so it's easier to read/utilize output from
sed 's/\s/\t/'
Replace the space between the two columns with a tab character, making the output more friendly
For large ZFS pools, this made creating my vdevs immeasurably easy. By keeping track of which disks were in which slot (spreadsheet) via their serial numbers, I was able to then create my vols simply by copying and pasting the full output of the disk (not the letter) and pasting it into my command. Thereby allowing me to know exactly which disk, in which slot, was going into the vdev. Example command below.
zpool create tank raidz2 -o ashift=12 ata-... ata-... ata-... ata-... ata-... ata-...
Show Sample Output
Description by segments delimited by pipe (|) 1. List all git branches 2. Exclude master 3. Trim output and remove display elements such as * next to current branch 4. Repeat branch name after a space (output on each line: branch_name branch_name) 5. Prepend each line with the git tag command 6. Execute the output with bash
Just 253 chars of pure UNIX magic, with curl. I created this contrived bash one-liner while building a command-line bash game : www.rubegoldbash.com. Show Sample Output
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: