getButterfly Logo getButterfly code wrangling since 2005

I’ll just dump some frequently used command line snippets here.

Unzipping a .gz or .tar.gz archive:

gzip -d file.gz

Unzipping a .tar archive:

tar -zxvf file.tar

Importing a database dump:

mysql -u[username] -p[password] database < file.sql


mysql -p -u username database < file.sql

You will be prompted for your database user password.

Exporting/dumping a database:

mysqldump --databases database > dump.sql


mysqldump database > dump.sql


mysqldump -u username -p[password] database > dump.sql

Listing the contents of a directory with details (permissions, size, etc.):

ls -las

Subscribe to getButterfly Blog

Once a week or so we send an email with our best content. We never bug you, we just send you our latest piece of content.

If you found any value in this post, agree, disagree, or have anything to add - please do. I use comments as my #1 signal for what to write about. Read our comment policy before commenting! Comments such as "Thank you!", "Awesome!", "You're the man!" are either marked as spam or stripped from URL.

Leave a reply