Posts filed under “Linux”
Permission denied: /var/www/xx/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
Sometimes I got this Error Message in Apache error.log Permission denied: /var/www/xx/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable I am using Parallels Confixx Software for managing the virtual hosts. When creating a new RootDirectory for a Domain via Confixx, it will be create with wrong ownerships. Setting ownerships via console will [...]
libMagick (ImageMagick cannot open shared object file: No such file or directory)
On Debian 5 (Lenny) after installing ImageMagick and rmagick, when testing my rails application: libMagickCore.so.2: cannot open shared object file: No such file or directory – /usr/lib/ruby/gems/1.8/gems/rmagick-2.8.0/lib/RMagick2.so Missing these required gems: rmagick … At first I thought it must be a problem of rmagick because apaches module passenger raises up an error about missing rmagick… [...]
Transferring Files with rsync and ssh from Server to Server
This rsync Command is really helpful for transferring data to another server. I need this very often. rsync -vrlptgoD -e ssh ./yourfile.tar.gz root@XXX.XX.47.73:/root If you need to change the ssh Port, you can write it as a string: rsync -vrlptgoD -e ‘ssh -p1356′ ./yourfile.tar.gz root@XXX.XX.47.73:/root Tweet
change owner of files or directories globally by searching for a group
Sometimes, thankfully not very often, I need to change the group or the user of many directories or files in a global way. This could happen owing to unfortunate circumstances, e.g when you switch a Serversystem to another and something went wrong or something happens you did not plan before. With this command I find [...]
Removing folders content except specific files or subfolders
I often need to remove files or folders in a dierctory – but I also often must not delete the whole directory, so here is the shell syntax for removing everything from a directory excepting your searchparameter. This removes all files and subfolders in your current folder, excepting the cgi-bin directory. ls | grep -v [...]
search a string within a gzip file
You can search within possibly compressed files for a regular expression. This helps me searching for strings in old compressed logfiles. zgrep [ grep_options ] [ -e ] pattern filename… This greps “searchstring” (without case sensitivity) from the compressed file in filename.gz and writes the results to a new file with the name Result. zgrep [...]
search and replace strings from file
Searching and replacing strings from a file can be done with sed. sed ‘s/’SEARCH_STRING’/'REPLACE_STRING’/g’ filename > new_filename Tweet
extracting specific files from a tarball
If you have a big tarball and you dont want to extract all files and folders of it, you can use grep to extract only specific files or folders. tar xfvkp Backup_23-06-07.tar.gz $(tar tf Backup_23-06-07.tar.gz | grep ‘mySpecific/Folder’) Tweet