Last active
January 14, 2019 16:04
-
-
Save bikalbasnet/2db0dba8e21a2ab6e9d3ee07245dede5 to your computer and use it in GitHub Desktop.
Common commands that I use (Chetsheet)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Setting The PATH on linux | |
| export PATH="$PATH:/path/to/dir" | |
| Symlink to Binaries | |
| sudo ln -s /path/to/binary /usr/bin/binary-name | |
| ### Export MYSQL database | |
| > mysqldump -u [username] -p [database name] > [database name].sql | |
| ### Import MYSQL database | |
| > mysql -u [username] -p newdatabase < [database name].sql | |
| ### Import PostgreSQL dump | |
| > pg_restore --verbose --clean --no-acl --no-privileges --no-owner -h database -U postgres -d dev dev_dump.dump | |
| ### `postgres` Grant all privileges to all tables within the database | |
| > GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO dev; | |
| > GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO dev; | |
| > ALTER USER dev WITH SUPERUSER; | |
| ## scp | |
| ### Copy file from remote to local | |
| > scp remoteuser@remoteuser:/path/to/file/in/remote /path/to/file/in/local | |
| ## Copy file from local to remote | |
| > scp /path/to/file/in/local remoteuser@remoteuser:/path/to/file/in/remote | |
| ### Generate password for symfony application directly on commandline | |
| > php -r "echo password_hash('ThePassword', PASSWORD_BCRYPT, ['cost' => 13]) . PHP_EOL;" | |
| ### Find folder by regex pattern | |
| find /var/lib/jenkins/workspace/ -type d -maxdepth 1 -name 'search_text_pattern*' | |
| ### Find folder by regex pattern and delete all empty folder (remove # in the end to make it work) | |
| find /var/lib/jenkins/workspace/ -type d -maxdepth 1 -name 'search_text_pattern*' #-delete | |
| ### Find folder by regex pattern and delete (remove # in the end to make it work) | |
| sudo find /var/lib/jenkins/workspace/ -type d -name 'search_text_pattern*' #-exec rm -r {} + |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment