FILE AND DIRECTORY BASICS | This cateogry also includes utilities that change file/directory properties and permissions |
ls | List files/directories in a directory, comparable to dir in windows/dos. |
ls -la | Shows all files (including ones that start with a period), directories, and details attributes for each file. |
cd | Change directory (e.g cd /usr/local/bin) |
cd ~ | Go to your home directory |
cd - | Go to the last directory you were in |
cd .. | Go up a directory |
cat | Print file contents to the screen |
cat filename.txt | Print the contents of filename.txt to your screen |
tail | Similar to cat, but only reads the end of the file |
tail /var/log/messages | See the last 20 (by default) lines of /var/log/messages |
tail -f /var/log/messages | Watch the file continuously, while it's being updated |
tail -200 /var/log/messages | Print the last 200 lines of the file to the screen |
head | Similar to tail, but only reads the top of the file |
head /var/log/messages | See the first 20 (by default) lines of /var/log/messages |
head -200 /var/log/messages | Print the first 200 lines of the file to the screen |
more | Llike cat, but opens the file one screen at a time rather than all at once |
more /etc/userdomains | Browse through the userdomains file. hit Spaceto go to the next page, q to quit |
less | Page through files |
od | View binary files and data |
xxd | Also view binary files and data |
gv | View Postscript/PDF files |
xdvi | View TeX DVI files |
nl | Number lines |
touch | Create an empty file |
touch /home/burst/public_html/404.html | Create an empty file called 404.html in the directory /home/burst/public_html/ |
file | Attempts to guess what type of file a file is by looking at it's content. |
file * | Prints out a list of all files/directories in a directory |
cp | Copy a file |
cp filename filename.bak | Copies filename to filename.bak |
cp -a /etc/* /root/etc/ | Copies all files, retaining permissions form one directory to another. |
cp -av * ../newdirectory | Copies all files and directories recurrsively in the current directory INTO newdirectory |
mv | Move a file command |
mv oldfilename newfilename | Move a file or directory from oldfilename to newfilename |
rm | delete a file |
rm filename.txt | deletes filename.txt, will more than likely ask if you really want to delete it |
rm -f filename.txt | deletes filename.txt, will not ask for confirmation before deleting. |
rm -rf tmp/ | recursively deletes the directory tmp, and all files in it, including subdirectories. |
chmod | changes file access permissions. The set of 3 go in this order from left to right: 0 = --- No permission |
chmod 000 | No one can access |
chmod 644 | Usually for HTML pages |
chmod 755 | Usually for CGI scripts |
chown | Changes file ownership permissions The set of 2 go in this order from left to right: USER - GROUP |
chown root myfile.txt | Changes the owner of the file to root |
chown root.root myfile.txt | Changes the owner and group of the file to root |
stat | Display file attributes |
grep | Llooks for patterns in files |
grep root /etc/passwd | Shows all matches of root in /etc/passwd |
grep -v root /etc/passwd | Shows all lines that do not match root |
ln | Create's "links" between files and directories |
ln -s /usr/local/apache/conf/httpd.conf /etc/httpd.conf | Now you can edit /etc/httpd.conf rather than the original. changes will affect the orginal, however you can delete the link and it will not delete the original. |
wc | Word count |
wc -l filename.txt | Tells how many lines are in filename.txt |
find | Utility to find files and directories on your server. |
find / -name "filename" | Find the file called "filename" on your filesystem starting the search from the root directory "/". |
locate filename | Find the file name and path of which contains the string "filename". Run 'updatedb' to build index. |
EDITORS | Most popular editors available on UNIX platforms. |
pico | Friendly, easy to use file editor |
pico /home/burst/public_html/index.html | Edit the index page for the user's website. |
vi | Popular editor, tons of features, harder to use at first than pico |
vi filename.txt | Edit filename.txt. All commands in vi are preceded by pressing the escape key. Each time a different command is to be entered, the escape key needs to be used. Except where indicated, vi is case sensitive. Fore more commands go to: http://www.intellink.net/vi-qref.htm H --- Upper left corner (home) :q! --- This force quits the file without saving and exits vi |
emacs | Another popular editor. For more commands go to http://www.hsrl.rutgers.edu/ug/emacs_qref.html C-\ t --- Tutorial suggested for new emacs users. |
emacs filename.txt | Edit filename.txt. While you're in emacs, use the following quickies to get around: C-x C-f --- read a file into emacs C-f --- move forward one character |
NETWORK | Some of the basic networking utilities. |
w | Shows who is currently logged in and where they are logged in from. |
who | This also shows who is on the server in an shell. |
netstat | Shows all current network connections. |
netstat -an | Shows all connections to the server, the source and destination ips and ports. |
netstat -rn | Shows routing table for all ips bound to the server. |
netstat -an |grep :80 |wc -l | Show how many active connections there are to apache (httpd runs on port 80) |
top | Shows live system processes in a formatted table, memory information, uptime and other useful info. While in top, Shift + M to sort by memory usage or Shift + P to sort by CPU usage |
top -u root | Show processes running by user root only. |
route -n | Shows routing table for all ips bound to the server. |
nslookup yahoo.com | Query your default domain name server (DNS) for an Internet name (or IP number) host_to_find. |
traceroute yahoo.com | Have a look how you messages travel to yahoo.com |
ifconfig | Display info on the network interfaces. |
ifconfig -a | Display into on all network interfaces on server, active or inactive.. |
ping | Sends test packets to a specified server to check if it is responding properly |
tcpdump | Print all the network traffic going through the network. |
arp | Command mostly used for checking existing Ethernet connectivity and IP address |
SYSTEM TOOLS | Many of the basic system utilities used to get things done. |
ps | ps is short for process status, which is similar to the top command. It's used to show currently running processes and their PID. A process ID is a unique number that identifies a process, with that you can kill or terminate a running program on your server (see kill command). |
ps U username | Shows processes for a certain user |
ps aux | Shows all system processes |
ps aux --forest | Shows all system processes like the above but organizes in a hierarchy that's very useful! |
kill | terminate a system process |
kill -9 PID | Immediately kill process ID |
killall program_name | Kill program(s) by name. For example to kill instances of httpd, do 'killall httpd' |
du | Shows disk usage. |
du -sh | Shows a summary of total disk space used in the current directory, including subdirectories. |
du / -bh | more | Print detailed disk usage for each subdirectory starting at the "/". |
last | Shows who logged in and when |
last -20 | Shows only the last 20 logins |
last -20 -a | Shows last 20 logins, with the hostname in the last field |
pwd | Print working directory, i.e., display the name of my current directory on the screen. |
hostname | Print the name of the local host. Use netconf (as root) to change the name of the machine. |
whoami | Print my login name. |
date | Print or change the operating system date and time |
time | Determine the amount of time that it takes for a process to complete + other info. |
uptime | Show the number days server has been up including system load averages. |
uname -a | Displays info on about your server such as kernel version. |
free | Memory info (in kilobytes). |
lsmod | Show the kernel modules currently loaded. Run as root. |
dmesg | less | Print kernel messages. |
man topic | Display the contents of the system manual pages (help) on the topic. Do 'man netstat' to find all details of netstat command including options and examples. |
reboot / halt | Halt or reboot the machine. |
mount | Mount local drive or remote file system. |
mount -t auto /dev/fd0 /mnt/floppy | Mount the floppy. The directory /mnt/floppy must exist. |
mount -t auto /dev/cdrom /mnt/cdrom | Mount the CD. The directory /mnt/cdrom must exist. |
sudo | The super-user do command that allows you to run specific commands that require root access. |
fsck | Check a disk for errors |
COMPRESSION UTILITIES | There are many other compression utilities but these are the default and most widely utilized. |
tar | Creating and Extracting .tar.gz and .tar files |
tar -zxvf file.tar.gz | Extracts the file |
tar -xvf file.tar | Extracts the file |
tar -cf archive.tar contents/ | Takes everything from contents/ and puts it into archive.tar |
gzip -d filename.gz | gzip -d filename.gz |
zip | Compress files into.zip |
unzip file.zip | Extracting .zip files shell command |
compress | Compress files. compress filename |
uncompress | Uncompress compressed files. uncompress filename.Z |
bzip2 | Compress files in bzip2 format |
THE (DOT) FILES | The good old dot files. Let's clear up some confusion here by defining each. |
.bash_login | Treated by bash like .bash_profileif that doesn't exist. |
.bash_logout | Sourced by bash login shells at exit. |
.bash_profile | Sourced by bash login shells after /etc/profile |
.bash_history | The list of commands executed previously. |
.profile | Treated by bash like ~/.bash_profile if that and .bash_login don't exist. |
.vimrc | Default "Vim" configuration file. |
.emacs | Read by emacs at startup |
CONFIGURATION FILES | Listing everything is beyond the scope of this article. |
/etc | This directory contains most of the basic Linux system-configuration Files. |
/etc/init.d | Contains the permanent copies of System V–style run-level scripts. These scripts are often linked to files in the /etc/rc?.d directories to have each service associated with a script started or stopped for the particular run level. The ? is replaced by the run-level number (0 through 6). (Slackware puts its run-level scripts in the /etc/rc.d directory.) |
/etc/cron* | Directories in this set contain files that define how the crond utility runs applications on a daily (cron.daily), hourly (cron.hourly), monthly (cron.monthly), or weekly (cron.weekly) schedule. |
/etc/cups | Contains files used to configure the CUPS printing service. |
/etc/default | Contains files that set default values for various utilities. For example, the file for the useradd command defines the default group number, home directory, password expiration date, shell, and skeleton directory |
/etc/skel | Any files contained in this directory are automatically copied to a user’s home directory when that user is added to the system. |
/etc/mail | Contains files used to configure your sendmail mail service. |
/etc/security | Contains files that set a variety of default security conditions for your computer. |
/etc/sysconfig | Contains important system configuration files that are created and maintained by various services (including iptables, samba, and most networking services). |
/etc/passwd | Holds some user account info including passwords (when not "shadowed"). |
/etc/shadow | Contains the encrypted password information for users' accounts and optionally the password aging information. |
/etc/xinetd.d | Contains a set of files, each of which defines a network service that the xinetd daemon listens for on a particular port. |
/etc/syslogd.conf | The configuration file for the syslogd daemon. syslogd is the daemon that takes care of logging (writing to disk) messages coming from other programs to the system. |
/var | Contains variable data like system logging files, mail and printer spool directories, and transient and temporary files. |
/var/log | Log files from the system and various programs/services, especially login (/var/log/wtmp, which logs all logins and logouts into the system) and syslog (/var/log/messages, where all kernel and system program message are usually stored). |
/var/log/messages | System logs. The first place you should look at if your system is in trouble. |
/var/log/utmp | Active user sessions. This is a data file and as such it can not be viewed normally. |
/var/log/wtmp | Log of all users who have logged into and out of the system. The last command can be used to access a human readable form of this file. |
Monday, July 30, 2007
QUICK LINUX GUIDE
Posted by Abhishek Jain at Monday, July 30, 2007 |
Labels: linux
Friday, July 20, 2007
New 7 World Wonders
New 7 World Wonders
Winners
WINNER—One of the New Seven Wonders of the World. Great Wall of China:
The 4,160-mile barricade running from east to west is the world's
longest man-made structure. The construction of the wall took place
over hundreds of years, beginning in the seventh century B.C.
WINNER—One of the New Seven Wonders of the World. Petra, Jordan: This
ancient city in southwestern Jordan, built on a terrace around Wadi
Musa, or Valley of Moses, was the capital of the Arab kingdom of the
Nabateans. The city is famous for water tunnels and stone structures
carved in the rock.
WINNER—One of the New Seven Wonders of the World. Christ Redeemer
Statue, Brazil: The outstretched arms of the 125-foot statue of the
Christ the Redeemer overlooks Rio de Janeiro from atop 2,343-foot Mount
Corcovado.
WINNER—One of the New Seven Wonders of the World. Machu Picchu, Peru:
Built by the Incan Empire in the 15th century, Machu Picchu's walls,
palaces, temples and dwellings are perched in the clouds at 8,000 feet
above sea level in the Andes.
WINNER—One of the New Seven Wonders of the World. Pyramid at Chichen
Itza, Mexico: This pyramid was part of a sacred site in an important
Mayan center on Mexico's Yucatan peninsula. Built according to the
solar calendar, shadows at the fall and spring equinoxes are said to
look like a snake crawling down the steps, similar to the carved
serpent at the top.
WINNER—One of the New Seven Wonders of the World. Colosseum, Italy: The
50,000-seat amphitheater in Rome was inaugurated in A.D. 80 and served
as the backdrop for thousands of gladiators who dueled to the death.
WINNER—One of the New Seven Wonders of the World. Taj Mahal, India: The
white marble-domed mausoleum in Agra combines Indian, Persian and
Islamic styles and was built by a 17th century Mogul emperor for his
favorite wife, who died in childbirth.
Finalists
FINALIST—The New Seven Wonders of the World. Acropolis, Greece: This
set-in-stone wonder attracts millions of visitors each year to its
famed Parthenon and statues of Greek gods and goddesses.
FINALIST—The New Seven Wonders of the World. Alhambra, Spain: The
palace and citadel—once the residence of the Moorish caliphs who
governed southern Spain—feature mosaics, arabesques and mocarabe, or
honeycomb work.
FINALIST—The New Seven Wonders of the World. Angkor, Cambodia: The
archaeological site in Siem Reap was the capital of the Khmer
(Cambodian) empire from the ninth to 15th centuries. The 12th century
ruins include Angkor Wat and Angkor Thom.
FINALIST—The New Seven Wonders of the World. Easter Island, Chile:
Hundreds of massive stone busts, or Moais, are all that remains from
the prehistoric culture that crafted them between 400 and 1,000 years
ago as an homage to deceased ancestors.
FINALIST—The New Seven Wonders of the World. Eiffel Tower, France: The
985-foot tower, built in 1889 for the International Exposition,
symbolizes Paris. The open-lattice iron icon is the City of Light's
tallest structure.
FINALIST—The New Seven Wonders of the World. Hagia Sophia, Turkey: Also
called the Church of Holy Wisdom, the soaring cathedral was built in
537 A.D. at Constantinople, today's Istanbul. In 1453, Constantinople
fell to the Ottomans and the church became a mosque. Not until the
landmark became a museum in 1935 were the Christian mosaics revealed.
FINALIST—The New Seven Wonders of the World. Kiyomizu Temple, Japan:
Kyoto's Kiyomizu-dera, which means Clear Water Temple, was founded by a
Buddhist sect in 798 and rebuilt in 1633 after a fire. A drink from its
waterfall is believed to confer health, longevity and success.
FINALIST—The New Seven Wonders of the World. Kremlin and St. Basil's
Cathedral, Russia: Domes with golden cupolas surrounded by red brick
walls are at the heart of Moscow's Kremlin. The Cathedral of St. Basil
the Blessed on adjacent Red Square features nine towers of different
colors.
FINALIST—The New Seven Wonders of the World. Neuschwanstein Castle,
Germany: The inspiration for the Sleeping Beauty Castle at Disneyland,
Neuschwanstein is a creation of 'Mad King' Ludwig II of Bavaria.
Perched on a peak in the Alps, the gray granite castle rises to towers,
turrets and pinnacles.
FINALIST—The New Seven Wonders of the World. Statue of Liberty, New
York: A gift of the French government, the 305-foot statue in New York
Harbor has welcomed immigrants and symbolized freedom since 1886.
FINALIST—The New Seven Wonders of the World. Stonehenge, Britain: How
and why this circular monument of massive rocks was created between
3,000 and 1,600 B.C. is unknown, but some experts say the stones were
aligned as part of a sun-worshipping culture or astronomical calendar.
FINALIST—The New Seven Wonders of the World. Sydney Opera House,
Australia: With a roof resembling a ship in full sail, the opera house
is situated on Bennelong Point reaching into Sydney's harbor. It was
designed by Danish architect Jorn Utzon and opened by Queen Elizabeth
II in 1973.
FINALIST—The New Seven Wonders of the World. Timbuktu, Mali: Two of
West Africa's oldest mosques, the Djingareyber, or Great Mosque, and
the Sankore mosque built during the 14th and early 15th centuries can
still be seen here in the northern Sahara Desert. Founded about A.D.
1,100, Timbuktu was a flourishing caravan center and a leading
spiritual and intellectual center.
Powered by ScribeFire.
Posted by Abhishek Jain at Friday, July 20, 2007 |
Labels: general
Subscribe to:
Comment Feed (RSS)