Archive for the ‘manual of the day…’ Category

How to find the Debian version

Sometimes it’s good to know which kind of Debian version you are running on your system. This small article shows you how to check for the version.

(more…)

Adding Core Data to Existing iPhone Projects with XCode 4

When you start developing a new iOS project sometimes it happens, that you want to add at a later stage Core Data support. In this case there are some requirements which need to beĀ fulfilled.

(more…)

flush memcached via command line

Just this simple command will flush the memcached cache:

echo “flush_all” | nc 127.0.0.1 11211

assuming that it runs on the localhost with the default port.

Completely remove MySQL server including all the data from Debian

I just tried to uninstall MySQL on Debian via

apt-get remove --purge mysql-server

apt-get remove --purge mysql-client

apt-get autoremove

and wondered that the directories /var/lib/mysql /etc/mysql still existed after the commands. Then I recognized, that a

apt-get remove --purge 'mysql-server.*'

is doing better and removes everything.

Note:

if you get a

/etc/init.d/mysql: WARNING: /etc/mysql/my.cnf cannot be read.

error when you try to re-install MySQL, try a

apt-get purge mysql-common

and try to re-install again.

get text between 2 lines from a file with sed

I just had the problem that I wanted to get 2000 lines of text from a big log file (> 20 million lines). It was too much to select it in my Terminal. The only thing I know was where the text of interest started and where it ended. Sed what the hero of this day and helped me with this command:

sed -n '19121287,19123287p' big_log_file.log > sliced_text.log

19121287 was the line number where it starts and 19123287 was the line where it ends.

Kill processes by their name

Sometimes you have lots of processes running on your Linux system and you want to kill them all. But you don’t want to spend too much time on killing each process by their process id. A good way to handle with this problem is to combine ps, with grep and awk:

ps -lax | grep "MY SEARCH PATTERN"| awk '{print $3}' | xargs kill -9

In this case I am getting the whole process list, then I search for processes which contain MY SEARCH PATTERN. After this I am getting the 3rd column, because there is the process ID. After that we kill ‘em all!

Completely remove MySQL server and MySQL client in Debian

Sometimes it is necessary to remove MySQL completely from your Debian system. E.g. after a complete misconfiguration. I had this problem and found this commands to get rid of MySQL server and client (in this case in version 5.1). Both commands need to be executed as root:

# apt-get autoremove --purge mysql-server mysql-server-5.0

# apt-get autoremove --purge mysql-client mysql-client-5.1

Repeat a shell command with a script N times

If you want to execute a shell command N times you can do this with a simple shell script. Let’s say your command is something like

curl http://www.website.com/file.txt > output.xml

and you like to execute this 10 times. Then just create a file (e.g. myscript.sh) and put

for i in {1..10}; do

curl http://www.website.com/file.txt > output.xml ;

done

into it. Give the file execute permissions and we are done.

Extracting a .war file

If you want to extract a .war file, because you need for example to change some files in it, just execute the following command:

jar xvf file.war

file.war is in this case the name of the war file. You need to change it of course to the correct filename from your system. :)

Getting information about a secure web server using openssl

To retrieve information about a web server which runs with https you can use openssl on the command line like this:

openssl s_client -connect www.INSERTSERVERHERE.com:443

Recursively remove .svn directories in Linux

Sometimes it’s necessary to get rid of all the .svn directories in a subversion managed project. You can easily do this on the Linux console by executing

rm -rf `find . -type d -name .svn`

in the base directory of the project.

Enable crontab logging in Debian Linux

By default the logging for the cron demon is not active in Debian Linux. To activate it, please open the file /etc/rsyslog.conf via

vi /etc/rsyslog.conf

and uncomment the line

# cron.*                          /var/log/cron.log

After that you need to restart rsyslog via

/etc/init.d/rsyslog restart

and you will find the cron logs in /var/log/cron.log

Next Page »" class="small button">older posts