Sometimes, when copying a shell script edited on a Windows machine to a linux machine, you will have the an issue relating to a “bad interpreter”. This can be caused by Windows CRLF vs Linux CR. A simple fix is to use the following perl command on the file.

perl -i -pe's/\r$//;' filename.sh

(filename.sh is the name of the file to be fixed)

A linux system admin is commonly tasked with changing permissions on directories. A helpful solution is creating a shell script to handle the workload for you. The below example can be modified to suit your needs of automatically creating a shell script that does what you need it to do on a large scale.

First, we need to create a file list of all the directories of a folder.

ls >> list.txt

You should now have a file with one folder per line.
Next, you will want to use the sed command to insert your command at the beginning of each line before the folder name.

sed 's/^/setfacl -R -d -m g::rwx /' list.txt >> whatever.sh

sed – linux sed command
' – opens argument
s/ – option
^/ – inserts at beginning of line
setfacl -R -d -m g::rwx / – text to add (close command with /)
' – closes argument
list.txt – filename to apply argument
>> whatever.sh – output to filename whatever.sh

Finally, make the shell script (in this case ‘whatever.sh’) executable.

chmod +x whatever.sh

Execute the command on your linux machine.

./whatever.sh

If using this example, your folders should now have their group rights acl set recursively.

Simple task using the find and attrib commands from the OES linux system shell.

find /media/nss/VOLNAME -exec /sbin/attrib {} -c=di \;

That’s it. It can take a while depending on the structure, but it will return results in realtime.

How it works:

The linux find command will display the path names to the current directory (or in this case, the path specified)

It is then told to execute (-exec) the NSS attribute (attrib) command.

The clear (-c) command is followed with an equals (=) sign and the requested attributes to clear (in this case ‘di’ for delete inhibit)

Alternatively, you can set use the above command to set attributes by changing the -d= to -s=

Here are all the attributes:

all - All (used only for the Clear option)
aa - Attribute Archive
ar - Archive
cc - Cannot Compress
ci - Copy Inhibit
cm - Compressed
dc - Don't Compress
di - Delete Inhibit
ex - Execute
hi - Hidden
ic - Immediate Compression
ip - Immediate Purge
ln - Link
mi - Migrate Inhibit
ri - Rename Inhibit
ro - Read Only
sd - subdirectory
sh - Shareable
sy - System
tr - Transactional
vo - Volatile

In the user root’s home directory (or user in question), enter the folder:

cd .vnc

Open ‘xstartup’ with vim editor

vim xstartup

Comment out the current window manager (normally twm) and enter ‘gnome &':
(Should look similar to below)(Use ‘i’ to enter insert edit mode)

#!/bin/sh

xrdb $HOME/.Xresources
xsetroot -solid grey
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm &
gnome &

(when finished, escape out of insert mode {ESC})

Save the file

(shift)Zz

Kill any open xsession:

vncserver -kill :2

Restart vncserver:

vncserver

On the next connect via VNC, you should have a gnome desktop staring back at you.

I always end up losing this much needed information. Below you will find the SQL statements to update a MySQL database with the correct information.

UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-site.com', 'http://www.zerowizard.com') WHERE option_name = 'home' OR option_name = 'siteurl';

Update URLs posts and pages that are stored in database wp_posts table as guid field:

UPDATE wp_posts SET guid = replace(guid, 'http://www.old-site.com','http://www.zerowizard.com');

Update URLs of links in posts pages that are stored in the wp_posts tables:

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-site.com', 'http://www.zerowizard.com');

Download the Java offline installer.
Run the executable and cancel the install.
The extracted files (msi and cab files) will be in the following directory:

C:\Users\{Username}\AppData\LocalLow\Sun\Java\

Copy the extracted files to the C drive.
Use the following command to install java from the msi without the Java updater or autoupdate check:

msiexec /i “c:\jre1.6.0_30\jre1.6.0_30.msi” JAVAUPDATE=0 JU=0 AUTOUPDATECHECK=0

Follow the on-screen prompts to complete the install.