Posts tagged with ‘command’

 

  • Archives

  • Categories

This is a personal note. This lets you check Ubuntu’s version number. Run the command ‘cat /etc/lsb-release’.

tkw@deathnode:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=9.04
DISTRIB_CODENAME=jaunty
DISTRIB_DESCRIPTION="Ubuntu 9.04"
tkw@deathnode:~$

My blog has pretty much become a scrap book.

To find Red Hat or CentOS linux version number use:

tkw@redhat:~$ cat /etc/redhat-release
CentOS release 4.8 (Final)

jer added that this is a better alternative:

lsb_release -a

Thanks!

 

Haskell hack

[via Yaxu.org]

 

This is nerdy. Raw footage of a performance that “CS rapper” Monzy gave last summer outside Stanford University’s Computer Science building.

Monzy performs at Stanford Univ.

kill -9

kill -9 no more CPU time and your processes are mine. kill -9 ’cause it’s my time to shine.

 

Or Gzip for the matter. Here’s the command to run in your UNIX-based server to import or export via an SQL file, this is useful for performing backup and restoring of a MySQL database. (I wrote a similar import and export guide for PostgreSQL.) The mysqldump utility performs just that:

Exporting using mysqldump:

mysqldump -u[Username] -p[Password] [Database] > output.sql

For example, my username is ‘kahwee’, my password being ‘secret’ and database being ‘justrealized_db’, I would run the following to export my database to a SQL file:

mysqldump -ukahwee -psecret justrealized_db > output.sql

And to Gzip:

mysqldump -u[Username] -p[Password] [Database] | gzip > output.sql.gz

Importing using mysql:

To import back, we can use the mysql utility in a similar fashion, note that the > (greater than) has change to a < (lesser than).

mysql -u[Username] -p[Password] [Database] < output.sql

For example, my username is ‘kahwee’, my password being ‘secret’ and database being ‘justrealized_db’, I would run the following to import my database:

mysql -ukahwee -psecret justrealized_db < output.sql

And to Ungzip:

gunzip < output.sql.gz | mysql -u[Username] -p[Password] [Database]

Backing up and restoring MySQL databases in Windows

Unfortunately, you can’t use gzip here. So all those commands above with gzip can’t work. The rest, however, still works. However, mysqldump and mysql may not be set in your system environment variables. These are instructions on how to add them for Windows Vista:

Editing system environment variables in Windows Vista.

Click on ‘Edit the system environment variables’, a dialog box will pop up. Click on ‘Environment Variables…’, you should be greeted with the following dialog box:

Editing the path for environment variables

My path looks like this before I add anything:

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem

Append your MySQL bin directory at the back of what is already there. I use XAMPP (XAMPP lite to be specific) which has its MySQL bin folder located here ‘;C:\xampplite\mysql\bin\’, so I would be appending this:

;C:\xampplite\mysql\bin\

That’s all I guess, hope it is helpful for you.

 

When you delete large portions for data from your MySQL table, the database becomes more fragmented. It is always a good idea to re-optimize your MySQL database especially if you have a lot of varying characters (VARCHAR). Here’s the command to optimize just one table:

OPTIMIZE TABLE foo

But I am looking for a more command line solution and here it is:

mysqlcheck -op database_name

The ‘o’ refers to optimize. And the ‘p’ is the option for password requirement. You’ll be prompted for the password.

If you’re logged in as user ‘john’ in your SSH, the MySQL username will be ‘john’. If that’s not what you want, use option ‘u’ like this:

mysqlcheck -op -u user_name database_name

And to optimize all databases:

mysqlcheck -op -u user_name –all-databases

You can also use option ‘r’ to repair.

Note that the optimization only works for MyISAM, InnoDB, and ARCHIVE tables.

 

What fun is there when sudo replies your incorrect password attempt with a mere incorrect password – make it insult you. Masochistic people can shout hooray.

Here’s how you do it, you have to edit ‘sudoers’. It uses vi commands which I hate. You’ll be prompted for your password.

sudo visudo

Append “,insults” at the end without the quotes and then save the file.

Defaults env_reset,insults

Now you can make your terminal window forget your sudo password:

sudo -K

And now type ‘sudo visudo’ or even ‘sudo me a sandwich’ and then input an incorrect password. It will say something like:

  • You can’t get the wood, you know.
  • It’s only your word against mine.
  • My pet ferret can type better than you!
  • Maybe if you used more than just two fingers…
  • Listen, burrito brains, I don’t have time to listen to this trash.

Well, have fun. (Source: Ubuntu Tutorials)

 

WordPress powered and Django inspired.
Love and elephants come after.
RSS: Posts and comments.