1 | find -size +10M -exec ls -lh {} \; |
1 | find -iname '*.jpg' -exec tar -rf bilder.tar {} \; |
1 | find -iname '*.mp3' -fprint playlist.m3u |
Find files with SUID bit set.
1 | find / -type f -perm +6000 -exec ls -l {} \; > suid.list |
1 | find -size +10M -exec ls -lh {} \; |
1 | find -iname '*.jpg' -exec tar -rf bilder.tar {} \; |
1 | find -iname '*.mp3' -fprint playlist.m3u |
Find files with SUID bit set.
1 | find / -type f -perm +6000 -exec ls -l {} \; > suid.list |
This is an example from http://www.linux-user.de/ausgabe/2001/07/030-split/split.html:
1 | tar cz /home/user | split -b95m - archiv.tgz.split. |
Put together files with:
1 | cat [dateiname].split.* | tar x |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | lib.nav-referenzen = COA lib.nav-referenzen { 10 = HMENU 10 { entryLevel = 3 special = browse special { items = prev items.prevnextToSection = 1 } 1 = TMENU 1 { NO { doNotLinkIt = 1 stdWrap.cObject = COA stdWrap.cObject { 10 = TEXT 10 { field = title typolink { parameter.field = uid returnLast = url } wrap = <a title="{field:title}" href="|"></a>&nbsp;&nbsp; insertData = 1 } } } } } 20 < .10 20 { special.items = next 1.NO.stdWrap.cObject.10.wrap = &nbsp;&nbsp;<a title="{field:title}" href="|">next &raquo;</a> } } |
with automaketemplate e.g: subparts.bottom < lib.nav-referenzen
with templavoila e.g.: lib.prevnextnavigation < lib.nav-referenzen
subparts.bottom and lib.prevnextnavigation are only sample object names. Replace them with your own subpartname or templavoila lib name.
It is not possible in Outlook to send an email blind carbon copy to a special email address automatically. E.g. you would like to send a copy of each email you send to watcher@mymail.com automatically.
A small Visual Basic Script can do the job. Open Outlook 2007 and press Alt+F11 for the Visual Basic Editor and put there the following code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) Dim objRecip As Recipient Dim strMsg As String Dim res As Integer Dim strBcc As String Dim objItem As MailItem Dim myRecipients As Recipients Dim myRecipient As Recipient If Not ActiveInspector Is Nothing Then If TypeOf ActiveInspector.CurrentItem Is MailItem Then strBcc = "watcher@myemail.com" End If End If On Error Resume Next Set objRecip = Item.Recipients.Add(strBcc) ' handle case of user canceling Outlook security dialog If Err = 287 Then strMsg = "Could not add a Bcc recipient " & _ "because the user said No to the security prompt." & _ " Do you want still to send the message?" res = MsgBox(strMsg, vbYesNo + vbDefaultButton1, _ "Security Prompt Cancelled") If res = vbNo Then Cancel = True Else objRecip.Delete End If Err.Clear Else objRecip.Type = olBCC objRecip.Resolve End If Set objRecip = Nothing End Sub |
Here is another version where you can filter the recipients and send mails to a special email address. E.g. you would like to send a bcc automatically to company1@mymail.com if you send mails to *@company1.com and to company2@mymail.com if you send mails to *@company2.com:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) Dim objRecip As Recipient Dim strMsg As String Dim res As Integer Dim strBcc As String Dim objItem As MailItem Dim myRecipients As Recipients Dim myRecipient As Recipient If Not ActiveInspector Is Nothing Then If TypeOf ActiveInspector.CurrentItem Is MailItem Then Set objItem = ActiveInspector.CurrentItem Set myRecipients = objItem.Recipients myRecipients.ResolveAll For Each myRecipient In myRecipients strBcc = "" If InStr(myRecipient.Address, "company1.com") Then strBcc = "company1@mymail.com" End If If InStr(myRecipient.Address, "company2.com") Then strBcc = "company2@mymail.com" End If Next End If End If On Error Resume Next Set objRecip = Item.Recipients.Add(strBcc) ' handle case of user canceling Outlook security dialog If Err = 287 Then strMsg = "Could not add a Bcc recipient " & _ "because the user said No to the security prompt." & _ " Do you want still to send the message?" res = MsgBox(strMsg, vbYesNo + vbDefaultButton1, _ "Security Prompt Cancelled") If res = vbNo Then Cancel = True Else objRecip.Delete End If Err.Clear Else objRecip.Type = olBCC objRecip.Resolve End If Set objRecip = Nothing End Sub |
To replace a string in all files inside a folder you can create a bash file:
1 | vi replace.sh |
Put inside this file:
1 2 3 4 5 6 | #!/bin/bash for file in $(ls -1); do sed 's/me/you/g' $file > /tmp/dummy.txt; mv /tmp/dummy.txt $file; done |
Save it and make it executeable (chmod 777 replace.sh)
1 2 3 4 5 | for file in $(ls -1); do mv $file $file.old sed 's/<b>/<strong>/g' $file.old > $file; done |
Another option is to use sed with -i command or direct editing:
1 2 3 4 | for file in $(ls -1); do sed -i 's/text_to_replace/text_replacement/g' $file done |
People often underestimate the usefulness of the linux-command screen.
What does screen do? Screen creates a terminal session for the actual user.
Type:
1 | screen |
to create a terminal session.
Or type:
1 | screen -S <sessionname> |
where <sessionname> should be replaced with your own name.
Create a new window:
1 | Crtl+a c |
which means (Press Control and a together and after that press c)
Now we created a second window. To list all created windows in the actual session type:
1 | Crtl+a " |
Germans have to press Shift+2 for “.
Now the two created windows will be shown:

Just choose one Window and press enter.
To quit your actual work an detach the session:
1 | Crtl+a d |
To list all active sessions:
1 | screen -list |
You should see a similar picture like the following:

Here you can see the name of the session: 1597.stefan
To restore the session simply type:
1 | screen -r stefan |
Maybe you have to type the complete id with 1597.stefan if there exist another session with the same name.
When switching from Mac to Linux and vice versa, I always have to think a bit about how to use the command top and sort by CPU.
With Linux it is
top
and then press
shift+p
Mac:
top -o cpu
I hope I can remember this
The situation is as follows. You want to search recursive for a text pattern inside of each files in the directory /var/www/vhosts. Take e.g. the pattern ‘DataStructure’.
Normally you would think about the find-command and executing another command but grep itself can do the job.
grep -RHl -e ‘DataStructure’ /srv/www/vhosts
This command lists all filenames containing the text ‘DataStructure’
To list all open connections on the actual linux or mac just type the following:
lsof -i
For faster lookup without replacing IP through DNS-lookup:
lsof -i -n
Try also with root-permission for more files:
sudo lsof -i -n
Now you can easily spot programs connecting to the internet an dump the tcp-data with tcpdump.
For example dumping data from tcp-port 80 to a file called test.pcap:
tcpdump -w test.pcap tcp port 80
Now show the file:
tcpdump -nnr test.pcap
or
tcpdump -ttttnnr test.pcap
for timestamp information
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();