Saturday, June 5, 2010

Bookmark các câu lệnh trong Linux

Đây là nơi tôi ghi nhớ các câu lệnh khi làm việc với LInux.
+fuser: to identify processes using file or socket.
---Usage---
When you try to umount some mount point, maybe receive an error alert like: Device is busy...So, you can identify what processes using mount point, and use kill to kill that process...
+df: disk free
---Usage---
To view the space and state of all partitions
+rpm: install/uninstall software with rpm package
---Usage---
Some useful and often using option:
-Try to uninstall a software when unknown the full name of that package.
use: rpm -qa | grep
ie:when you want to uninstall VMware
command: rpm -qa | grep VM
+ldd
---Usage---
syntax:
ldd [program]
This command will show what library is neccessary for this program.
ex:
[cuong@CentOS5 Ebooks and Documents]$ ldd /bin/bash
linux-gate.so.1 => (0x00e74000)
libtermcap.so.2 => /lib/libtermcap.so.2 (0x07471000)
libdl.so.2 => /lib/libdl.so.2 (0x0076d000)
libc.so.6 => /lib/libc.so.6 (0x005e8000)
/lib/ld-linux.so.2 (0x005c9000)
+fsck
---Usage---
Check error for filesystem
+ln
---Usage---
make a link between files
syntax:
ln filename newname
when make link with the path, ln called symbolic link or symlink.
syntax:
ln /path/to/old/file /path/to/new/file
+find
---Usage---
To find files
ex:
find /bin -name ls
How the command above works?!
that command will look up in /bin firectory and find any file that named ls, when found, it will display to screen
+wc
---Usage---
wc-word count-the command to display the whole file. It will display the line, words, bytes of file
ex:
[cuong@CentOS5 27-6]$ ls
text1.txt
[cuong@CentOS5 27-6]$ wc text1.txt
1 6 25 text1.txt

As you see, wc counts the line, words, and bytes of text1.txt: 1 line, 6 words, 25 bytes
+tail
---Usage---
Print the last 10 lines of file to standard output
ex:

[cuong@CentOS5 27-6]$ wc tex2.txt
15 13 30 tex2.txt
[cuong@CentOS5 27-6]$ tail tex2.txt
t
y
u
w
d
x
h
j
ky
+split: split file into smaller parts 

usage: this command will split a file into smaller parts tha you can specific some characteristics for each parts. Assume i have a file of 12GB, i want split that file into some parts that each part is 4GB to burn into DVD disk, so i could use this option for split command:
#split 4048M myfile  mypart

This command will devide myfile into some smaller files and each file is 4048M(~4gb) and the splitted files name are begin with mypart( mypartaa, mypartab...).

No comments:

Post a Comment