Home > centOS, Fedora 12, Unix/Linux > Linux – centOS/Fedora 12 Common syntex

Linux – centOS/Fedora 12 Common syntex

uname -a # system details
ifconfig -a # show interface detials
netstat -na | less # list less with open ports
/etc/init.d/network restart # reload the internet connections

Directory browse/manage

tree /etc/yum
ls -a # show hidden files
df # disk useage
du # show each directory uses
du -hs /etc # show the folder size
\cp -rfR source1 source2 sourceXz /media/backup #multi folders to copy with one command

find /usr -name “filename.ext” # search a file by directorys
rpm -q nameof_program # show file zip etc
tail -f /path/where/file.txt # update on append auto

pgrep firefox

ps aux | less
ps -A
ps -e
ps -U root -u root -N
ps -u shamun
ps -ejH
ps axjf
ps -eLf

ps axms

# ps -elf | grep “php script.php” to avoid this we can do as following:
ps -C “php script.php”

# to check whats going on for this process id you can apply this
[root@www tmp]# ps -lf –ppid=26701
0 S root     26705 26701  0  78   0 – 15968 wait   20:46 pts/0    00:00:00 sh -c \cp -frR /etc /var/www/html /usr/share/postfixadmin-2.3 /home /tmp/database.sql /media/2010-06-04;du -hs /media/usb/2010

top -b -n1 > /tmp/process.log
top -b -n1 | mail -s ‘subject’ email@email.com

pgrep -u root sshd


ls | grep shamun
– | is the pipe
– the pipe means that the output is redirected to grep, which then searches that text for “shamun”
– each command has it’s funktion, if you need to cmbine them, you need a pipe the transport the output to the next command
– in other words, pipe feeds the stdout of one command as stdin to another

Partitioning/Disk access:

cfdisk – Interactive hard disc partition utility for text mode.
fdisk – Launches a menu-driven program that partitions a hard disk.
parted – command line partitioning tool. (parted sometimes complains about boundaries of partitions created with fdisk. parted can format a partition of type ext2 or fat32 partition while creating it.)
mkfs – front-end to various filesystem-creation tools
parted can create a filesystem while partitioning
mkfs.vfat /dev/sde1 to format a fat32 partition sde1
mkfs.ext2 /dev/sde2 to format an ext2 partition sde2
tune2fs – command to tune ext2/ext3 filesystems
Howh: tune2fs -j /dev/sde2 to convert an ext2 filesystem sde2 to ext3 by adding a journal
tune2fs -L /dev/sde2 bulkdata to set the volume label of sde2 to “bulkdata”
debugfs – Interactive utility to repair the ext2 filesystem on specified drive.
e2fsck- Performs an analysis of the filesystem’s integrity and optionally repairs errors.
badblocks – Scans the specified drive for bad blocks.
Using a configured hard drive or tape
hwinfo – Automatically recognizes all available CD-ROM drives.
mount – Attaches the device to a specified directory, which will serve as the filesystem’s mount point.
sync – Flushes the filesystem buffers.
umount – Unmounts the filesystem specified by the device.
duchs – Lists the largest directories in human readable format
eject – Ejects the media in the specified drive.
mc (midnight commander) – Command line file manager. Can undelete files in unmounted ext2 filesystems.
partimage – Backs up disk partitions into image files and restores them.

Search advanced
Open a terminal for several options:
find / -file ‘name_of_file’ [translattion: find from the root of the system any file matching the name ‘name of file’]

or another example:
find /home -name *txt [translation: find every file under the directory /home ending in “.txt”].

locate name_of_file

If you are looking for executables:

which name_ of_executable [ provides the full path to executable]

If you are looking for a manual page

man name_of_command

If you don’t know the name of the command,

apropos key_word_related_to_command

Categories: centOS, Fedora 12, Unix/Linux Tags:
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: