Recent Posts

HOWTO: restore a deleted file in git

less than 1 minute read

$ git rev-list -n 1 HEAD -- path_to_file #this gives you the commit's hash $ git checkout commit_hash^ -- path_to_file # it restores the file

HOWTO: print the nth line of a file

less than 1 minute read

$ awk 'NR==1524' file.txt # print the 1524th line of the file using awk $ sed -n '1244p' file.txt # print the 1244th line of the file using sed

HOWTO: drop all tables in MySQL

less than 1 minute read

Unfortunately MySQL doesn’t have any command to drop all tables or to truncate the database. It has just DROP TABLE and DROP DATABASE.