dealing with local mta

MTA stands for „mail transfer agent“. Popular ones are sendmail, exim and postfix. If you want to know what MTA is running locally you can check which program listens on port 25: lsof -i :25 You might also telnet on port 25 and let the MTA himself respond who he is: telnet localhost 25   For configuring exim4 the preferred way is to use the graphical interface, call it with: dpkg-reconfigure exim4-config    

0
Read More

mssql-check-connection

Easiest way to check a connection for a MSSQL database: Create a file called : myfile.udl Paste the following content (make sure to use your settings): [oledb] ; Everything after this line is an OLE DB initstring Provider=SQLOLEDB.1;Persist Security Info=False;User ID=myUsername;Data Source=100.200.3.4;Password=myPassword  

0
Read More

show word occurence in pdfs on commandline

Do you want to know how often words occur in a pdf file? And sort them by the most occurring word: pdftotext mypdf.pdf – | sed „s/[[:cntrl:][:digit:][:punct:]]//g“ | tr ‚[:space:]‘ ‚[\n*]‘ | sort | uniq -c | sort -bnr Let’s break it down step by step: pdftotext mypdf.pdf – displays the pdf content on the command-line   sed „s/[[:cntrl:][:digit:][:punct:]]//g“ replaces all control characters (cntrl), all numbers (digits) and all punctuation characters (punct) with an empty string. See here for character classes. tr…

0
Read More

PDF Frontpage to jpg

First find all the files you want to convert and store their filenames in a file find my-pdf-folder/ -type f -name „*.pdf“ > pdffiles.txt Iterate through that files and make a jpeg from them while read -r LINE; do pdftoppm -f 1 -singlefile -jpeg „$LINE“ „$LINE“; done < pdffiles.txt Finally move all jpgs to a separate location if necessary find my-pdf-folder/ -type f -name „*.jpg“ -exec mv {} jpgs/ \;  

0
Read More

.htaccess redirections

Simply redirecting a domain, ending with source to target/index.html RewriteRule ^source/?$ http://www.test.de/target/index.html [L] Redirecting can also be done with the Redirect Command Redirect 301 /source /target/some-folder Redirecting a complete folder structure can be done like this: RedirectMatch 301 ^/source/(.*)$ http://mydomain.de/target/$1 Redirect a request for a specific file to a folder (http://www.test/upload/file.pdf -> http://www.test.de/downloads/) The flag R stands for redirect, L stands for Last (the rule will be executed immediately, without chaining another rule) RewriteEngine On RewriteRule ^/?file\.pdf$ http://www.test.de/downloads/ [R, L]…

0
Read More

perform action on multiple files found with find command

In reality you have quite often perform a certain command on several files. First i detect all files I’m looking for and store them in a filelist. find . -name „myFilename“ > filelist.txt Second i run through this file, line by line and perform my command on all filename I’ve received one step before. while read -r LINE; do echo „$LINE“; done < filelist.txt You need to replace in several files. You can do it with sed. Be aware about…

0
Read More

how to detect space usage in linux

Getting the size of all files and folders inside the current directory can be done by typing:  ls | xargs du -s -BM Get filesize in descending order from all files in a recursive folder structure find . -type f -exec du -a -h –max-depth=100 {} + | sort -hr Another quite handy tool is ncdu. It provides you the disc usage in a graphical way on the shell. Install it like this: sudo apt-get install ncdu List folders bigger…

0
Read More

handle multiple shell sessions with tmux

What is tmux? A handy tool for dealing with different bash sessions is tmux. It’s comparable with gnu screen but by far more advanced. You can get it with: sudo apt-get install tmux Launch it by typing: tmux Shortcuts an Commands Dealing with sessions brings great power. You can set up your multi-windows panes on a remote machine, in a seperate session. Now you can detach from this session and log out. When you later ssh back into this machine…

0
Read More

Monitoring processes with htop on the shell

Want to have a more advanced and easy (intuitive) tool than top, for monitoring, sorting, filtering, killing processes? than htop is the tool of your choice. Simply install it by using: sudo apt-get install htop and start it with: htop Have fun watching your processes.

0
Read More