Query to list top 10 largest tables in MySQL DB
mysql> SELECT concat(table_schema,'.',table_name) table_name,concat(round(data_length/(1024*1024),2),'M') data_length FROM information_schema.TABLES ORDER BY data_length DESC LIMIT 10;
Tech tips…
mysql> SELECT concat(table_schema,'.',table_name) table_name,concat(round(data_length/(1024*1024),2),'M') data_length FROM information_schema.TABLES ORDER BY data_length DESC LIMIT 10;
If during an lftp session you get the error message:
get: Access failed: 521 Data connections must be encrypted. (xxx.tar.gz)
You will need to set this variable:
lftp username@host.com:/> set ftp:ssl-protect-data true
If you ever need to grep some specific tags in a bunch of pdf files, you can use the following one liner, e.g:
for FILE in $(find /home/user/Desktop/downloads/ -name "*.pdf" 2>/dev/null -mtime -1 \! -type d -exec ls {} \;); do pdftotext $FILE - | grep -o 'BZ [0-9]\{5\}';done
I get the following error when executing a binary file:
error while loading shared libraries: libcrypto.so.4: cannot open shared object file: No such file or directory
This error is likely to occur either because you have not properly defined your $LD_LIBRARY_PATH or the file is simply missing.
To debug try the following:
ldd {binary_file}
or to get more verbose information:
export LD_DEBUG=libs;{binary_file}
for more options:
export LD_DEBUG=help;{binary_file}
Encrypt the file:
openssl des3 -salt -in file.txt -out encrypted_file.txt
Decrypt the file:
openssl des3 -d -salt -in encrypted_file.txt -out decrypted_file.txt
If you are a command line addict, you can download shell-fm and start listening Last.fm from there.
Links to customize it:
http://jdin.blogspot.com
http://shell-fm.wikidot.com/extending-shell-fm
“The transaction log in database tempdb is almost full. Your transaction
is being suspended until space is made available in the log.”
If you are getting this error message you can extend tempdb running the following commands:
disk init name ="extra_tempdb", physname ="/opt/sybase/data/extra_tempdb", vdevno=8, size=512000
alter database tempdb on extra_tempdb = 500
alter database tempdb log on extra_tempdb = 500
fsniper allow to monitor your folders and trigger some actions based on the type of files you have there.
Example: ~/.config/fsniper/config
PDF files downloaded from Firefox on the desktop, get moved to ~/Desktop/pdf.
watch {
~/Desktop {
*.part {
handler = echo ignoring file: %%
}
application/pdf {
handler = mv %% ~/Desktop/pdf
}
}
}
Fsniper can be run in daemon mode:
fsniper --daemon
Add group with specfic id:
# groupadd -g {gid} {group}
Add existing user to existing group:
# usermod -G {group} {username}
Check to which group a user belong:
# id -nG {username}
Remove existing user to existing groups (group1,group2,group3.group4), e.g remove it from group3:
# usermod -G {group1,group2,group4} {username}
mysqldump --opt --where="true LIMIT 1000000" mydb > mydb1M.sql
mysqldump --opt --where="true LIMIT 1000000" mydb mytable > mydb_mytable_1M.sql
mysql -p mydb_1 < mydb1M.sql