egginfo logo

Unix / Linux Shell Commands

Below we list a few of the basic commands to get you started on your shell.

blockDirectoriespwd, cd, mkdir, rmdir, rm -rf
blockFilesls, ls- l, cp, mv, rm
blockShortcutscd, alias
blockSearchfind, grep
blockGetting Helpman, apropox
blockExtract archivestar, unzip, gunzip
blockSystemps, kill, uptime
blockChmod
blockAbout yourselfwhoami, passwd, quota, du, last
blockAccessing external sitesftp, wget, lynx, telnet

blockDirectories

Display the current directory path you are in.

pwd

Change directories

cd directory
cd path\to\directory

Create a new directory

mkdir directory_name

Delete an empty directory

rmdir directory_name

Delete a directory and all sub directories/files.

rm -rf directory_name

blockFiles

List files in a directory

ls
ghost@localhost [~/eggdrop1.6.17]# ls
./           configure*        doc/           language/    NEWS
../          configure.ac      eggdrop.conf*  logs/        README
aclocal.m4   CONTENTS          FEATURES       Makefile     scripts/
ChangeLog    COPYING           help/          Makefile.in  src/
config.h.in  disabled_modules  INSTALL        misc/        text/
ghost@localhost [~/eggdrop1.6.17]#
ls -l
ghost@localhost [~/eggdrop1.6.17]# ls -l
total 928
drwxr-xr-x  10 ghost ghost   4096 Aug 23  2004 ./
drwx--x--x   9 ghost ghost   4096 Dec 15 21:00 ../
-rw-r--r--   1 ghost ghost  38095 Aug 23  2004 aclocal.m4
-rw-r--r--   1 ghost ghost 354604 Jun 14  2004 ChangeLog
-rw-r--r--   1 ghost ghost   9874 Jul 25  2004 config.h.in
-rwxr-xr-x   1 ghost ghost 325533 Aug 23  2004 configure*
-rw-r--r--   1 ghost ghost   4357 Jul 26  2004 configure.ac
-rw-r--r--   1 ghost ghost   1637 Jul 25  2004 CONTENTS
-rw-r--r--   1 ghost ghost  18007 Aug  3  2000 COPYING
-rw-r--r--   1 ghost ghost    409 Jun  4  2002 disabled_modules
drwxr-xr-x   5 ghost ghost   4096 Aug 23  2004 doc/
-rwxr-xr-x   1 ghost ghost  51322 Aug 22  2004 eggdrop.conf*
-rw-r--r--   1 ghost ghost   2519 Jul 25  2004 FEATURES
drwxr-xr-x   4 ghost ghost   4096 Aug 23  2004 help/
-rw-r--r--   1 ghost ghost   5786 Aug  8  2004 INSTALL
drwxr-xr-x   2 ghost ghost   4096 Aug 23  2004 language/
drwxr-xr-x   2 ghost ghost   4096 Aug 23  2004 logs/
-rw-r--r--   1 ghost ghost    175 Aug 23  2004 Makefile
-rw-r--r--   1 ghost ghost  13110 Jul 25  2004 Makefile.in
drwxr-xr-x   2 ghost ghost   4096 Aug 23  2004 misc/
-rw-r--r--   1 ghost ghost   8060 Aug  2  2004 NEWS
-rw-r--r--   1 ghost ghost  25091 Aug  9  2004 README
drwxr-xr-x   3 ghost ghost   4096 Aug 23  2004 scripts/
drwxr-xr-x   5 ghost ghost   4096 Aug 23  2004 src/
drwxr-xr-x   2 ghost ghost   4096 Aug 23  2004 text/
ghost@localhost [~/eggdrop1.6.17]#

copy a file to another filename.

cp filename1 filename2

move or rename a file

mv filename1 filename2
mv filename1 directory\filename2

Delete a file (with rm you will not usually get a prompt to confirm)

rm filename

blockShortcuts

Go to a directory within your home directory.

cd ~/directory

Change to your home directory

cd (by itself)

Go back 1 directory in the tree

cd ..

Create your own shortcuts for a command

alias shortcut='full command'

See a list of shortcuts that you have already created

alias (by itself)

blockSearch

Locate a file on the shell (looking in all sub directories)

find . -name filename -print

look for a file that contains a specific word and/or phrase

grep word file(s)
grep blowfish *

blockGetting Help

Look up in the manual for information on a command

man command

Getting help when you have an idea of what to do but do not know what the relavent command is

apropos word

blockDecompress / Extract Files

decompress a .tar.gz file:

tar -zxvf filename


decompress a .tar file:

tar -xvf filename


decompress a .zip file:

unzip filename


decompress a .gz file:

gunzip filename

blockSystem

Display basic information about current running processes.

ps x
ghost@localhost [~/egg]# ps x
  PID TTY      STAT   TIME COMMAND
32667 ?        S      0:06 ./eggdrop ./med.conf
22093 ?        R      0:00 sshd: ghost@pts/21
22094 pts/21   Ss     0:00 -bash
25039 pts/21   R+     0:00 ps x
ghost@localhost [~/egg]#
Display more detailed information about runnging processes including memory/process usage.

ps ux
ghost@localhost [~/egg]# ps ux
USER  PID   %CPU %MEM VSZ  RSS TTY     STAT START TIME COMMAND
ghost 32667 0.0  0.6  8328 2928 ?      S    Dec13 0:06 ./eggdrop ./med
ghost 22093 0.0  0.5  7436 2404 ?      S    17:56 0:00 sshd: ghost@pts/
ghost 22094 0.0  0.3  4380 1428 pts/21 Ss   17:56 0:00 -bash
ghost 25036 0.0  0.2  4480  916 pts/21 R+   18:39 0:00 ps ux
ghost@localhost [~/egg]#
If you want to terminate a process (eggdrop etc) use kill -15, as this will allow your process to perform any maintenance it needs to do before teminating (i.e. the eggdrop will be able to save its current userfile and settings before closing). Only if the process fails to respond to this use kill -9, as this will send a teminate signal without allowing any maintenance to be done before the process stops.

Kill a process corresponding to a PID number.

kill -15 #PID          (Only use kill -9 #pid if your bot does not respond to a kill -15 #pid signal)
kill -9 #PID
kill -9 32667

Kill / Terminate all running processes in your account.

kill -15 -1
kill -9 -1

The uptime shell command shows the time since the system was last booted, the number of active user processes and a final column showing something called load averages. The 3 Values for load averages are taken from the last 1, 5 and 15 minutes and represent CPU utilisation.

Ideally a load average below 1 is ideal, when you start to commonly see averages above 2 you should consider investing in a new server or upgrades to current hardware. You will notice high load average by poor response times from the machine.

uptime

ghost@localhost [~]# uptime
21:13:09 up 16 days, 23:37, 2 users, load average: 0.01, 0.10, 0.08
ghost@localhost [~]#

blockChmod

Chmod changes the access privaledges on a file making it readable, writable and/or executable. It defines which users may have access to a file and how much access they have.
ghost@localhost [~/eggdrop1.6.17]# ls -l
total 928
drwxr-xr-x  10 ghost blue   4096 Aug 23  2004 ./
drwx--x--x   9 ghost blue   4096 Dec 15 17:56 ../
-rw-r--r--   1 ghost blue  38095 Aug 23  2004 aclocal.m4
-rw-r--r--   1 ghost blue 354604 Jun 14  2004 ChangeLog
-rw-r--r--   1 ghost blue   9874 Jul 25  2004 config.h.in
-rwxr-xr-x   1 ghost blue 325533 Aug 23  2004 configure*
-rw-r--r--   1 ghost blue   4357 Jul 26  2004 configure.ac
It is the first column that we are interested in for now.

This column shows what access a file already has and is split into 3 sections, which can be represented by letters.

  User  Group Others/Everyone
- ---   ---   ---
  rw-   r--   r--

LetterDefinition
u The User who owns the file (this means “you.”)
g The Group the file belongs to.
o The Other users.
a All of the above (an abbreviation for ugo)

To change the access permissions of a file you use the command chmod as discussed a little later.

LetterCorrespnding NumberDefinition
r 1 Permission to Read a file (list a directory).
w 2 Permission for Writing to and deleting files and/or directories.
x 4 Permission to eXecute (run) a file.

The octal (0-7) value is calculated by adding up the values for each digit

User (rwx) = 4+2+1 = 7
Group(rx) = 4+1 = 5
Others (rx) = 4+1 = 5
chmod mode = 755

Using the information in the above tables you can use the methods below to change the permissions on a file.

chmod who=permission(s) filename

chmod numbers filename

We will show you some examples of both these mothods using this file:

-rwxr-xr-x   1 ghost ghost  51322 Aug 22  2004 egg.conf

permissions beforeCommands permissions after
-rwxr-xr-xchmod 700 egg.conf-rwx------
-rwxr-xr-xchmod go= egg.conf-rwx------
-rwxr-xr-xchmod u=rw egg.conf-rw-r-xr-x
-rwxr-xr-xchmod 555 egg.conf-r-xr-xr-x

Personally i prefer using the numbers as opposed to letters to represent permissions on a file.

Here is a little chmod calculator that will help you work out the octal number for what permissions you would like to achieve:

owner group other
read
write
execute

Permissions:      

blockAbout Yourself

Display what username you are currently logged on under

whoami

Change your password

passwd

Display your current quota on the shell

quota -v

Display current disk usage of a filename and/or directory. Without an option it will use the current directory. du -s will only give a total.

du filename/directory

Shows a list of your last logins

last YourUsername

blockAcessing external websites/files

Accessing an ftp site from your shell

ftp hostname

ftp ftp.eggheads.org

common commands to remeber using ftp are get, dir, cd. You can type help command at any time while using ftp on your shell.

Getting a file directly from an http or ftp site without logging in.

wget file

wget ftp://somewebsite.com/filename.zip

wget http://www.somwhere.org/download/file.tar.gz

Browse the web from an ordinary terminal, type H at any time to learn more about lynx

lynx

To connect to a remote host you can use telnet as follows:

telnet hostname

Please report inaccuracies or errors that I have made to ghost@~nospam~.egginfo.org
 
blueline
Home, Tcl Tutorial, Tcl/Tk Installation, Modules, Tcl Scripts, Misc Downloads, Bot Commands,
Help/FAQ, Unix Commands, Message Commands, Shell Info/Reviews, About, Contact, Links. Nano & Pico.
Bnc's, Config Generator, OnJoin/Greet Generator, Identification Generator, Botnet creation & userfile sharing
IPV6, Vi Editor, Sitemap, Knowledgebase .

Select your language:
ENGLISH/US LITHUANIAN
 
eXTReMe Tracker
Valid HTML 4.01! Valid CSS!
 
blueline
Copyright © 2008 egginfo.org - All Rights Reserved.