Author Archives: Linuxgal
TC07 – Regicide
The “sea” of Aramel is a lake fed by melt water from a barren and twisted land, a low gravelly pass where the northern and southern sheets of ice came together as one. In the year following the return of … Continue reading
Palindate
Palindromic ISO dates between two years with #Python #!/usr/bin/python3 import sys from datetime import datetime from itertools import chain def palinDay(y): s = str(y) r = s[::-1] iso = ‘-‘.join([s, r[0:2], r[2:]]) try: datetime.strptime(iso, ‘%Y-%m-%d’) return [iso] except ValueError: return … Continue reading
Grep
Find non-text files: grep -iR -m 1 g” ” | grep “Binary file”
Rename
Recursively change spaces to hyphens in filenames: find . -name “* *” -print -exec rename “s/ /-/g” {} \;
Awk
List files and directories with sizes: ls -lF | awk ‘{printf “%s\t”, $5;printf “%s\n”,$9}’ or du -sk * | sort -rn | head -30
File
Find all the symbolic links in a directory: find /bin/ -name “*” | sort | xargs file -N | grep symbolic | sed ‘s/ symbolic link to//’
Xclip
Copy command-line output to the system clipboard so you can fuck around in a GUI: cat spock2.txt | xclip -selection clipboard
Set
List environment variables in order: set | awk ‘gsub(/(^)[[:upper:]]/,”&”) == NF’