1. Show the CPU temperature
more /proc/acpi/thermal_zone/THM/temperature
2. Show your network IP
All you network devices IPs:
/sbin/ifconfig
Show just you wired network IP (elegant display)
/sbin/ifconfig eth0|grep inet|awk {‘print $2′}|cut -d”:” -f2
3. SVN Checkout to FTP
I used this way to avoid checking out an svn release to my computer and then send it to our server by FTP. To do that, you need an ssh session:
# We can the export option to have a clean copy (without tracking files..)
svn export [repository] [local path]# an example:
svn export svn://rubyforge.org/var/svn/redmine/trunk ~/public_html/railsroller/a_redmine_release/
# a_redmine_release/ will be created automatically
4. Killing a process (useful for daemon servers)
To kill a process, you need to know its Process ID (PID), to list all running processes/PID use:
ps
And then, just type
kill 4556
with 4556 is the process PID. This could not work if the process is a bad guy then use:
kill -9 4556
5. How to use vi to build rails application
For text use of rails, refer to those links:
http://cmgm.stanford.edu/classes/unix/vi_qref.html
http://www.tech-recipes.com/unix_tips219.html
For ruby/rails writing, several plugins are developed for coloring, autocompletition.. could be found on this link:
http://wiki.rubyonrails.org/rails/pages/HowtoUseVimWithRails
6. How to search your disk
To quickly find file.type in /a/path use this command:
find /a/path -name ‘file.type’
Look at this link for other samples: http://www.computerhope.com/unix/ufind.htm#03
7. How to decompress linux archives
To quickly decompress .tar.gz files, just type:
tar zxvf file.tar.gz/tar.bz2
To quickly archive a tree (.tar):
tar -cvf filename.tar tree/
refer to this page: http://www.redhat.com/docs/manuals/linux/RHL-7.2-Manual/getting-started-guide/s1-zip-tar.html
8. Mount an ISO file as a CD drive
After creating a cd1 directory in /mnt/, run this command:
mount -o loop -t iso9660 file.iso /mnt/cd1
9. Change the owner of a file
You have just to run this command:
chmod new_owner file_name
# It is better to su on the owner of the file to avoid permission problems
10. Find files containing some text
How to find in /your/tree files containing “Some text” ? Here the answer:
find /your/tree -type f -print | xargs grep “Some text”
You can look here for a grep version.
11. VI: Copy/Paste Stuff
The ability to duplicate text in an editor can be handy. vi and vim have several useful copy and paste commands.
The command ‘Y’ or ‘yy’ copies (yanks) one or more lines. To copy one line, two lines, 10 lines, and all lines to the end of the file, respectively:
Y
2Y
10Y
yG
To paste the text contained in the buffer above (uppercase P) or below the current cursor position (lowercase p), respectively:
P
p
It is also possible to yank text within a line. The following commands yank text from the current cursor position to the end of the word and the end of the line, respectively:
yw
y$
The same commands paste the text within a line. Lower case p pastes after the cursor position and upper case P pastes before.
Paste will also work with deleted text, either lines or parts of lines. Be careful not to execute any other commands prior to pasting as this will empty the buffer.
12. Which ruby are you using?!
When you are running on a linux box and you have installed your own ruby, so you may be using the preinstalled one, to check the path of the ruby (or any other symblic link your are using), just type:
which ruby
Tags: bz, chown, compress, copy, CPU, decompress, find, FTP, IP, iso, Linux, mount, paste, search, SVN, Temperature, unix, vi, which



May 21, 2009 at 4:14 pm
I liked “SVN Checkout to FTP”