Archive for the ‘Linux’ Category

UNIX/LINUX REFERENCE CARD -2

Saturday, November 29th, 2008

Disks and Filesystems

df …………………………. Show free disk space
mount …………………….. Make a disk accessible
fcsk ……………………... Check a disk for errors
sync ………. Synchronizes filesystem buers and disk
quota …………... Check disk quota for current user

Backups and Remote Storage

mt …………………………..Control a tape drive
dump ……………………………..Back up a disk
restore ………………………... Restore a dump
tar ………... Read/write (compressed) tape archives
rsync ……………………….. Mirror a set of files
dar ……………………………... Archive a disk

Environment

env ………………... Display environment variables
echo ……………………………... Print variable
export ………... Write environment variables (Bash)
set . Write environment variables with more options
unset ……………….. Unset environment variables

Scheduling Jobs

sleep ……………………. Delay for specified time
watch ………………. Run programs at set intervals
at ………………………………. Schedule a job
cron …………………………….. Clock daemon
crontab …………... Schedule repeated jobs for cron
expect ….Automates tasks using interactive programs

Printing

lpr ………………………………….. Print files
lpq …………………………... View print queue
lprm …………………………. Remove print jobs

Processes

ps …………………………….. List all processes

w …………………………... List usersprocesses
uptime ……………………... View system uptime
top …………………………... Monitor processes
xload ………………………. Monitor system load
kill ……………………….. Terminate processes
nice …………... Run process with modified priority
renice …………….. Alter running processpriority

Hosts

uname ………………….. Print system information
hostname ……………. Print the system’s hostname
ifconfig ………….Set/display network information
host ……………………………... Look up DNS
whois ………………... Look up domain registrants
ping ... Check reachability and response time of a host
traceroute ………….. View network path to a host

File Editing

vim ………………………………... Text editor
gvim ………………….Forks a GUI version of ViM
emacs ………………………………. Text editor
sed ……………………... GNU stream text editor

Spelling Operations

ispell ……………….. Check spelling interactively
look …………………………... Look up spelling

Networking

ssh ………………... Securely log into remote hosts
scp ……………... Securely copy files between hosts
sftp …………….. Securely copy files between hosts
wget ………………………. Retrieve a url to disk
curl ………………………. Retrieve a url to disk
gaim …………………………..Instant messaging
talk ………………………….. Linux/Unix Chat
write ……………….. Send messages to a terminal
mesg ………………….. Enable/prohibit talk/write
finger …………... Display information about users
who ………………………..Show who is logged in
last ………... Displays login and logout information

Email, News and Web Browsing

pine ……... Terminal-based email and news program
mutt ………………. Terminal-based email program
mail ………………………... Minimal mail client
links …………………….. Text-only web browser
firefox ………………………. GUI web browser

Text Processors and Viewers

latex ………………. Compiles LaTeX TeX DVI

pdflatex ………………..Compiles LaTeX PDF

bibtex …………………….Compiles BiBTeX files
gv ……………………..View Postscript/PDF files
xdvi ………………………... View TeX DVI files
dvips ……………….Prints/converts TeX DVI files
ps2pdf ………………. Converts Postscript PDF

 

Image Manipulation/Display

xv …………………………... Image viewer for X
qiv ……………. Fast gdk/imlib image viewer for X
feh ……………….. Fast imlib2 image viewer for X
display ……………... ImageMagick: display image
convert …………….. ImageMagick: convert image
identify …….. ImageMagick: display file image info
import ….ImageMagick: save screen/window as image
compare …………... ImageMagick: compare images
xfig …………………….. Tool for drawing figures
transfig ……. Converts g portable LaTeX figure

 

Development

cscope ………... Interactively examine a C program
gcc ……………………Compiles C and C++ code
gdb ……………………. Debugger for C and C++
javac ………………………..Compiles Java code
jdb ………………………….. Debugger for Java
awk ……... Pattern scanning and processing language
perl …………………. Perl programming language
python ……………. Python programming language
ruby …………………Ruby programming language
matlab …………….. Technical computing language
mathematica ……. Mathematical computing language

Encryption

pgp ……………….. Public key encryption program
gpg ………….. GnuPG: an encryption tool like PGP

Terminal Emulators

xterm …………... Standard terminal emulator for X
rxvt …………. Lightweight terminal emulator for X
mrxvt …………... Multi-tab enabled version of rxvt

 

 

Tags:
Posted in Linux | No Comments »


UNIX/LINUX REFERENCE CARD -1

Saturday, November 29th, 2008

Basic File and Directory Manipulation

ls ……………………….. List directory contents
cp …………………………………... Copy file
s
mv …………………………….Move/rename file
s
rm ………………………………... Remove file
s
shred ………………………. Destroy data in file
s
ln …………………………………….Link file
s
cd ……………………………..Change director
y
pwd ………………. Print present working director
y
mkdir …………………………... Make director
y
rmdir …………………………. Remove director
y

File Viewing

cat ………….. Concatenate files and print to stdout
more …………………………. Page through file
s
less …………………………. Page through file
s
nl …………………………. Number lines of file
s
od …………... Prints file in octal and other format
s

File Text Manipulation

grep ……………. Search text for matching patterns
cut ………….Remove sections from each line of file
s
paste ………………………... Merge lines of file
s
tr …………………. Translate or delete character
s
join ………….. Join lines of files on a common fiel
d
split ……………………….. Split file into piece
s
csplit ……... Split file into sections by context line
s
sort …………………………………. Sort line
s
uniq ……….. Remove duplicate lines from sorted fil
e
fmt ………………... Simple optimal text formatte
r

File Properties

stat …………………………..Display file status
wc ……………………... Count bytes/words/line
s
du ………………………….. Estimate disk usag
e
file …………………... Manipulate file attribute
s
touch ……………………. Change file timestamp
s
chown ………………………... Change file owne
r
chgrp ………………………….Change file grou
p
chmod ……………………. Change file protection
s

File and Commands Location and Help

find ……………………………….. Locate files
locate …………………….. Locate files via inde
x
which ………………………... Locate command
s
apropos ………Locate commands by keyword looku
p

File Compression

gzip …………... Compress/decompress files (LZ77)

bzip2 ………….. Compress/decompress files (BWT)

[un]zip ….. (De-)Compress files (PKZIP compatible)

 

File Comparison and Patching

diff …………………... Compare files line by line
patch ………………. Apply changes from a di file
comm ……………………….. Compare sorted files
cmp …………………... Compare files byte by byte
md5sum …….Compute and check MD5 message digest

 

 

 

Tags:
Posted in Linux | No Comments »


yum ile Update / Install Packages (Redhat Enterprise)

Friday, September 26th, 2008

Öncelikle sistemimiz RHN’ye kayıt ettiriyoruz. (Tabi ki önceden Redhat şirketine parasını ödeyip üyeliğimizi aktif etmemiz gerekiyor)

# rhn_register

Update edebileceğimiz tüm paketlerin listesi görek için;

# yum list updates

Sistemimizin ihtiyacı olan tüm paketleri  yüklemek için;

# yum update

Sistemimizde yüklü olan tüm paketleri görmek için;

# rpm -qa   veya

# yum list installed

Herhangi özel bir paketin yüklü olup olmadığını öğrenmek için (mesala httpd package )

# rpm -qa | grep httpd*

# yum list installed httpd

Eğer sadece bir paket yüklemek istiyorsak;

# yum update {package-name-1}

Örnek hhtpd paketini yüklemek için

# yum update httpd

Paket ismini tam öğrenmek için

# yum list {package-name}

# yum list {regex}

# yum list httpd

# yum list perl*

Hehangi bir paketi install etmek için;

# yum install {package-name-1} {package-name-2}

# yum install httpd

Herhangi bir paketi  Uninstall  etmek için

# yum remove {package-name-1} {package-name-2}

# yum remove httpd

Yükleyebilecweğimiz tüm paketlerin listesini almak için;

# yum list all

Son olarak yum paketinin tüm yapabileceklirni öğrenmek istiyorsanız;

# man yum

Tags: ,
Posted in Linux, ipucu | No Comments »


CentOS / Red Hat Linux üzerine VSFTPD FTP Server kurulumu

Monday, September 22nd, 2008

Eğer Redhat abonesi isek

# yum install vsftpd

Ya da rpm paketini indirip

rpm-ihv  vsftpd-2.0.5-12.el5.i386.rpm

vsftpd servisinin  işletim sistemi açıldıktan hemen sora çalışması için;

# chkconfig vsftpd on    komutu ile  konfigure ederiz.

vsftpd stop start or restart

# service vsftpd start

# service vsftpd stop

# service vsftpd restart

FTP portuna iptables’den izin vermek için;

# vi /etc/sysconfig/iptables

-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 21 -j ACCEPT

yukarıdaki satırı iptables dosyası içine ekliyoruz. Bu kuralın aktif olması için iptables servisini yeniden çalıştırıyoruz.

# service iptables stop

# service iptables start

ftp serverin çalışıp çalışmadığını test etmek için:

$ ftp localhost

Eğer vsftpd serveri configure etmek istiyorsak;

# vi /etc/vsftpd/vsftpd.conf

 

 

Posted in Linux, ipucu | No Comments »


Redhat Enterprise Linux 5 üzerine lighttpd 1.5.0 kurulumu

Monday, September 22nd, 2008

Apache’den daha hızlı olmak amacıyla yazılan lighthttpd sistem kaynakları konusunda rakiplerine nazaran çok daha tutumludur. CGI desteği sayesinde her türlü dilde yazılmış uygulamanın çalıştırılabilmesine olanak verir. Apache gibi modüller kullandığı için yüksek özelleştirilebilirlik sağlar. Özellikle static dosyalarda okuma ve yazma gibi işlemlerle uğraşmadan çalışan mantığı sayesiyle static dosyaların yayınlanmasında Apache’ye üstünlük sağlamıştır. PHP performansı açısından da Apache’den pek çok noktada üstünlüğü ile dikkat çekmiştir. Üstelik ücretsiz dağıtımı yapılan Lighthttpd’yi sizde kurup performansını görmek isterseniz. Aşağıdaki kurulum adımlarını takip etmeniz tavsiye ederim.

Download lighttpd

cd /opt
wget http://www.lighttpd.net/assets/2007/2/23/lighttpd-1.5.0-r1691.tar.gz
tar -zxvf lighttpd-1.5.0-r1691.tar.gz

Aşağıdaki development kütüphaneleri sistemimizde yoksa install etmeliyiz

  • glib2-devel : Gnome header files for version 2 of the GLib library
  • openssl-devel – Used by core and SSL support
  • pcre-devel – Used by mod_redirect, mod_rewrite,
  • bzip2-devel – Use by compress-bzip2
  • zlib-devel – Used by compress-gzip and compress-deflate. It contains the header files and libraries.

yum install glib2-devel openssl-devel pcre-devel bzip2-devel gzip-devel

Configure lighttpd

# ./configure --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --with-openssl

Install lighttpd

# make
# make install

lighthttpd user/group ve directory oluşturalım

# adduser -m -d /var/www -s /sbin/nologin lighttpd
# mkdir /etc/lighttpd/
# mkdir /etc/lighttpd/ssl
# mkdir /var/log/lighttpd
# mkdir -p /var/www/html
# chown lighttpd:lighttpd /var/log/lighttpd

Lighttpd temel configuration

# cd /etc/lighttpd
# wget http://www.cyberciti.biz/files/lighttpd/1.5.0/lighttpd.conf.txt
# mv lighttpd.conf.txt lighttpd.conf
Copy lighttpd init.d file:
# cd /etc/init.d
# wget http://www.cyberciti.biz/files/lighttpd/1.5.0/lighttpd.init.d.txt
# mv lighttpd.init.d.txt lighttpd
# chmod +x lighttpd
# chkconfig on lighttpd


My setup:
# uname -mrs
Output:

Linux 2.6.18-8.1.1.el5 x86_64

# cat /etc/redhat-release
Output:

Red Hat Enterprise Linux Server release 5 (Tikanga)

# lighttpd -v
Output:

lighttpd-1.5.0 (ssl) - a light and fast webserver
Build-Date: Mar 31 2007 13:40:13

lighttpd servisini başlatmak için:
# /etc/init.d/lighttpd start

80. Portun aktif olduğunu görmek için:
# netstat -tulpn | grep :80

Posted in Linux | No Comments »


En güncel Linux çekirdeğini nereden / nasıl öğrenirim?

Monday, September 22nd, 2008

Linux çekirdeğinin en güncel sürümünü ve sürüm bilgilerini daimi olarak http://www.kernel.org adresinden takip edebilirsiniz.

Posted in Linux, ipucu | No Comments »


Linux File System

Wednesday, August 27th, 2008

File Management

File Management

Posted in Linux | No Comments »


Overview of File Management Systems

Wednesday, August 27th, 2008

Feature ext2 ext3 ReiserFS3.6 (not supported by Oracle)
Maximum partition size 4TB 4TB 16TB
Maximum file size 2GB-2TB 2GB-2TB 8TB
Block size 1KB-4KB 1KB-4KB 4KB only
Journaling capabilities No Yes Yes
Reboot after a crash Slow Fast Very Fast
State of data after crash Good Very Good Fair
ACL support Yes Yes No
Stability Excellent Good Good

Posted in Linux | No Comments »


find komut ile uzantıya göre dosya silmek için

Wednesday, August 27th, 2008

find /home -name *.avi -print -exec rm -rf {} \;

Posted in Linux | No Comments »


Linux File Systeminin Kurtarılması

Monday, August 18th, 2008

Sistem çökmesi veya mecburi resetleme olayı sonrasında sistemin açılmadığı durumlardasistemi kurtarmak için; 

#fsck.ext2     /dev/hdaX 
#fsck  -p /dev/hdax

Posted in Linux | No Comments »