Last active
January 24, 2018 21:04
-
-
Save rriveras/6495416 to your computer and use it in GitHub Desktop.
This file contains 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
# MYSQL import, this let you know where it goes the import by | |
# looking what is the last table that print | |
mysql -uroot mydatabase_development -A | |
show tables; | |
# UNIX command and tricks | |
# Search string in directory | |
# ref: http://stackoverflow.com/a/16957078 | |
grep -rnw --exclude-dir=node_modules . -e "string-pattern" | |
# Find who is using some port, in this example, the port is `3000` | |
lsof -i :3000 | |
# or | |
# ref: https://stackoverflow.com/a/19728840 | |
sudo lsof -i:<port-number> | |
# or | |
# ref: http://stackoverflow.com/a/3855359 | |
netstat -anp tcp | grep 3000 | |
# or | |
lsof -i :4000 | grep LISTEN | |
# or, if u want the <PID> to do a `kill -9 <PID>` | |
lsof -i tcp:3000 | |
# OR find a service | |
ps -def | grep passenger | |
# RESTART vagrant network | |
sudo ifconfig vboxnet0 down | |
sudo ifconfig vboxnet0 up | |
# -r: recursive | |
# . : search the current directory | |
# --exclude Exclude files | |
# Split a huge file in small chunks, in this case, 1Gb chunks with the a name that start with PREFIX_ ( -d use numeric suffixes instead of alphabetic, doesn't work on MAC ) | |
split -b 1024m name_of_the_file PREFIX_ | |
# To join the files, list the chunks with cat and tell where you want output the file | |
cat small_file_01 small_file_02 small_file_03 > NEW_FILE | |
# or, get all by the prefix | |
cat PREFIX_* > NEW_FILE | |
# Change file names in bulk. | |
# In this example, we change all file names ([a-z]) with extension txt | |
# to the same name, but with _ | |
# ahji.txt > ahji_.txt | |
mmv "*[a-z].txt" "#1_.txt" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment