| Command | Description |
|---|---|
| cd .. | Move up one level to upper directory. |
| cd /root | Move |
| pwd | Show working directory (your current position). |
| ls -lah | Show all files and directory in working dir with format as list, all (show hidden files) and human readable size (eg. with Mb). I use it as general listing. |
| ls -ltr | ls with order by date. |
| ls | wc -l | Count files on a directory. |
| ls -lahS | ls with order by file size. |
| df -h | Check disk space. |
| du -hd 1 /root | Check disk usage for every directories under |
| wget -c -url- | Use |
| grep -Rnw '/path/to/search' -e 'pattern' | find in files, use |
Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts
Linux Commad Quick Reference
Calculate days in BASH
I need a quick ways to calculate age in days from a given date, so i use this command:
echo \(`date +%s`-`date -d '2012-04-01' +%s`\)/86400 | bc
echo \(`date +%s`-`date -d '2012-04-01' +%s`\)/86400 | bc
Copy a Symbolic Link on Linux
The Problem:
I can't use cp to copy a symlinks to a directory, but i don't want to re-create it which could lead to typo problem due to long target path.
The Solution:
After quick search i found two working ways to do it.
First,
you still need to re-create then link but doesn't have to re-type target path, use readlink output instead.
ln -s `readlink ~/v1/jboss-deploy` ~/v2/jboss-deploy
In above command the `jboss-deploy` is a symlink to a directory somewhere in this box.
Second,
just use -P option on cp
cp -P ~/v1/jboss-deploy ~/v2/
well, then i should admit that i never read cp manual carefully... =="
I can't use cp to copy a symlinks to a directory, but i don't want to re-create it which could lead to typo problem due to long target path.
The Solution:
After quick search i found two working ways to do it.
First,
you still need to re-create then link but doesn't have to re-type target path, use readlink output instead.
ln -s `readlink ~/v1/jboss-deploy` ~/v2/jboss-deploy
In above command the `jboss-deploy` is a symlink to a directory somewhere in this box.
Second,
just use -P option on cp
cp -P ~/v1/jboss-deploy ~/v2/
well, then i should admit that i never read cp manual carefully... =="
HOWTO: Download package dependencies for offline installation
Hari ini kebetulan ada waktu untuk mempelajari instalasi OpenOffice.org3 dengan menggunakan bantuan buku + cd info linux extra no.01/2009, isinya full tentang OOo3.
Skip dulu yang lainnya, langsung ke installasi! di buku itu dijelaskan step-by-step installasi pada Windows, OSX, dan Linux (Ubuntu 8.10, untuk distro lainnya hanya sekilas saja). Langsung coba install di XP, lancar, seperti biasa aja tinggal klik next terus :), berikutnya install di OSX, nah kalo ini saya ga punya jd skip aja deh.
Berikutnya adalah ubuntu, kebetulan versi-nya sama dengan ubuntu di komp yang sedang saya gunakan. Tapi maklum karena ini komp bekas pegangan orang lain dan baru bbrp hari saya pakai jadi ngga tau apakah OOo yang ada jalan atau tidak (kemungkinan besar sih tidak) karena ternyata tidak jre atau jdk yang terinstall. Itu pun baru saya ketahui pada saat install OOo3 tiba-tiba muncul message "javaldx: Could not find a Java Runtime Environment!". Setelah saya cek pada synaptic pkg manager, memang pkg jre atau jdk memang tidak terinstall... duh. Ternyata cd info linux tidak menyertakan jre. Memang ga susah sih, kita tinggal pake synaptic untuk download dan install jre/jdk nya (soalnya saya ga pegang cd ubuntu-nya :( ), tapi ada bbrp komp dengan os ubuntu yang akan di-upgrade OOo-nya. Setelah googling dikit saya nemu cara untuk mendownload package beserta dependencies-nya, sehingga saya bisa download pkg jre untuk dipajang di server files dan tidak perlu dowload jre setiap install jre.
Skip dulu yang lainnya, langsung ke installasi! di buku itu dijelaskan step-by-step installasi pada Windows, OSX, dan Linux (Ubuntu 8.10, untuk distro lainnya hanya sekilas saja). Langsung coba install di XP, lancar, seperti biasa aja tinggal klik next terus :), berikutnya install di OSX, nah kalo ini saya ga punya jd skip aja deh.
Berikutnya adalah ubuntu, kebetulan versi-nya sama dengan ubuntu di komp yang sedang saya gunakan. Tapi maklum karena ini komp bekas pegangan orang lain dan baru bbrp hari saya pakai jadi ngga tau apakah OOo yang ada jalan atau tidak (kemungkinan besar sih tidak) karena ternyata tidak jre atau jdk yang terinstall. Itu pun baru saya ketahui pada saat install OOo3 tiba-tiba muncul message "javaldx: Could not find a Java Runtime Environment!". Setelah saya cek pada synaptic pkg manager, memang pkg jre atau jdk memang tidak terinstall... duh. Ternyata cd info linux tidak menyertakan jre. Memang ga susah sih, kita tinggal pake synaptic untuk download dan install jre/jdk nya (soalnya saya ga pegang cd ubuntu-nya :( ), tapi ada bbrp komp dengan os ubuntu yang akan di-upgrade OOo-nya. Setelah googling dikit saya nemu cara untuk mendownload package beserta dependencies-nya, sehingga saya bisa download pkg jre untuk dipajang di server files dan tidak perlu dowload jre setiap install jre.
Subscribe to:
Posts (Atom)