Sometimes one need to send an email from Linux (automated messages, warnings and so on). The problem is that the content looks strange when received by the email clients. The issue could be related to character encoding and UTF8. Here is a php script I used to send an email with the correct character encoding.

The unix ‘mutt’ command can be used to send an email with attachment: mutt -s “Test message” name@something -a files.tar < message.txt where files.tar is the attached file, and message.txt is the file containing the message. Subject to the email is added with the -s option. In this case: -s “Test message” name@something is the

Create a tar file of files located in a folder: tar -cvf filname.tar foldername/ where: c = create v = verbose f = file filname.tar = the created file ———- To show the content of a tar’ed file: tar -tvf filname.tar ———- extract a file with tar: tar -xvf filname.tar where x = extract v

I needed to find and get a webpage’s img src url links. I wanted to do this with a script on a regular basis. The solution I found was to use PHP domdocument: [php] <?php $url=""; $html = file_get_contents($url); $doc = new DOMDocument(); @$doc->loadHTML($html); $tags = $doc->getElementsByTagName(‘img’); foreach ($tags as $tag) { echo $tag->getAttribute(‘src’);

We needed to collect “Place” information per user from our LDAP server. The problem was that the description of the “Place” came out strangely encoded whenever it contained one of the norwegian characters æ,ø or å. The ldap command: ldapsearch -x -H ldap:// x121Address=XXXXXX where XXXXXX is the “place” code, gave a place description that

Search for information from a ldap server: Log in to server with: ssh servernavn Then type the command: ldapsearch -x -H ldap:// uid=userid ldapsearch -x -H ldap:// departmentnumber=XXXXXX where XXXXXX is placecode