Mindblown: a blog about philosophy.
-
How to move files starting with special chars as dashes
If it has come that you have tried to scape, enclose or do whatever to files starting with for example a dash, so as you can rename it, or copy it or scp it and didn’t find out how, this is how you can do it: mv -file-with-a-dash file-without-dash #one of the possible ways mv…
-
Recursively copy and rename files with find and sed
Script to recursively copy and rename files with find and sed find aber/cs25010/ -iname “*.txt” -printf ‘cp %p %p\n’ \ | sed ‘s/\.txt$/\.php/’ \ | while read l; do eval $l; done
-
Compare two Directories Using Diff
Compare directories using diff. diff -qr dirA dirB | sort
-
Batch dvd vob to one avi
Convert your dvd to avi in one command. cat *.vob | ffmpeg -i – -ab 192k -ar 48000 -b 1800k -vcodec libxvid -acodec libmp3lame “name goes here.avi”
-
Enable / Disable Screen Sharing in Terminal
No description :/ # To enable screen sharing: sudo sh -c “/bin/echo -n enabled > /private/etc/ScreenSharing.launchd” # To disable screen sharing: sudo sh -c “/bin/rm /private/etc/ScreenSharing.launchd”
-
Move small files to separate directory in one command
Loop files under a set weight to move it to a directory. for f in `find . -iname “*.JPG” -size -500k`; do mv ${f} small; done
-
Check httpd.conf syntax in Apache Severs
Some times its hard to make changes to productions servers configuration. In apache you can check http.conf syntax before you restart or reload the service. # /usr/sbin/httpd -t
-
Check if a program (ex: Chrome) is installed
This command works in systems running apt . With dpkg you can list all packages installed and the output is filtered with grep. dpkg −l | grep chrome
-
Delete empty directories
Delete all empty directories found with find find -depth -type d -empty -exec rmdir {} \;
-
Ext3 format USB Drive on Linux
Format an usb drive from cli. With fdisk you can list existing partitions in the system. fdisk -l # -c option checks for bad sectors mkfs -t ext3 -c /dev/sde1
Got any book recommendations?