How to Use the Ls Command on Linux or Mac OS X to Sort Files based on Second in the Timestamp
Here is the one liner. ls -lhtTr It will output something like total 24152 -rw-rw-r-- 1 sean staff 1.0M May 4 14:31:42 2019 4c2caf52cb084ea39a6a65a0e68ee382 -rw-rw-r-- 1 sean staff 1.0M May 4 14:31:44 2019 76eeeea5d...
Written by Sean Behan on 05/04/2019
How to Use the Ls Command on Linux or Mac OS X to Sort Files based on Second in the Timestamp
Here is the one liner. ls -lhtTr It will output something like total 24152 -rw-rw-r-- 1 sean staff 1.0M May 4 14:31:42 2019 4c2caf52cb084ea39a6a65a0e68ee382 -rw-rw-r-- 1 sean staff 1.0M May 4 14:31:44 2019 76eeeea5d...
Written by Sean Behan on 05/04/2019
How to Time Piped *nix Commands
If you want to time how long a piped bash command take, use the `time` command followed by your commands in parens like so.. time (ls -lha | wc -l)
Written by Sean Behan on 12/11/2017
How To Create a Dump File in Postgres Compatible with Heroku
When Heroku creates a dump file of your Postgres database it uses the `-Fc` option It is equivalent to running pg_dump -Fc -d name_of_db > name_of_db.dump This command will let you import your database with the `pg_restore` command pg_rest...
Written by Sean Behan on 03/06/2017
How to Fix Pypi Upload failed (403): Invalid or non-existent authentication information.
If you run into authentication failure when trying to upload packages Submitting dist/ to https://upload.pypi.org/legacy/ Upload failed (403): Invalid or non-existent authentication information. error: Upload failed (403): Invalid or non-existent...
Written by Sean Behan on 03/02/2017
Find a File On Your File System with the Unix Find Command By Extension
find path/ -name *.txt
Written by Sean Behan on 11/05/2013
A Couple of Usefule Snippets When Working with Textmate
Here is the snippet f path/to/directory 'search string' | open_in_mate This snippet (technically 2 snippets) will recursively scan the contents of files in a directory and then open all the files it finds in Textmate. It's useful on large projec...
Written by Sean Behan on 10/18/2013
How To Pipe To A Ruby Command Line Application
You need to read from STDIN rather than parse command line arguments. while $stdin.gets puts $_ end
Written by Sean Behan on 10/17/2013
How to Split a Large File Into Smaller Files on OSX or Unix
Use the split command. split -l 1000 name-of-file output/directory You can set the number of lines (the "-l" flag) to split on and also the location of where the split files should be saved. Note, the output directory must already exists....
Written by Sean Behan on 10/08/2013
Recursively Search Contents of a File with Grep
The -r flag is for recursive, meaning it will also look in sub directories. The -i flag is for case insensitivity, meaning WORD and word will both be found. grep -ir "search term" directory/path
Written by Sean Behan on 08/29/2013
How To Create Blurry Background Images Programmatically from the Command Line or with Ruby
Turn this into this You can use ImageMagick to make blurry images. To install with Homebrew on OS X. brew install imagemagick After installing you can run from the command line convert yourimage.png -channel RGBA -blu...
Written by Sean Behan on 08/24/2013
Launch Photoshop (Or Any App) From The Command Line on Mac OS X
I often find myself coding with the terminal open. Cding around a web app project I usually end up at some point launching Photoshop. Either to touch up or work on a psd, png, jpg ...etc. I fire up Photoshop and then navigate to the app's public directory...
Written by Sean Behan on 06/17/2012
Recursively Zip a Directory and Files on Linux
It's Short and sweet! Just remember that the finished zip filename is the first argument and the directory you wish to recursively zip comes after. zip -r name_of_your_directory.zip name_of_your_directory That's all. You might be intere...
Written by Sean Behan on 03/05/2017
Add Users to a Group on Ubuntu
To create a new user on Ubuntu (Heron8) adduser johndoe To create a new group groupadd barleyfarmers Add johndoe to the barleyfarmers group adduser johndoe barleyfarmers The adduser command, when you're first adding the new user accou...
Written by Sean Behan on 03/02/2017