Basic Shell Commands Tutorial

If you are new to UNIX-based systems, it would be a good idea to look over this list of basic shell commands.   These commands cover the basic operation and navigation of the shell.   If you know any other commands that would be useful to list here, please send email to admin@valueshells.com.


The '$' used in the examples is the placeholder for the shell prompt. You will most likely see a different prompt. The '$' is not part of the commands, and is just an example shell prompt.

Index

Changing your password in the shell
Installing psybnc
Installing Bot
Listing files in the shell
Navigating directories within in the shell
Navigating out of directories
Viewing running processes on the shell
Killing a running process
Editing files within the shell
Creating a folder within the shell
Removing directories within the shell
Removing files and non-empty directories within the shell
Copying files within the shell
Viewing a list of vhosts on the shell
To connect to IRC in the shell
Downloading files to your shell
Dealing with compressed files in the shell (compressing, decompressing, etc)
Compressing a directory into a .tar.gz file

Changing your password in the shell:

$ passwd

Note: this will prompt you for your old password, and then your new password, and then to verify your new password again.

 

Installing psybnc in ValueShells:

$ getpsy

This will ask you to put port that you want for the psybnc, please put port between 10000 - 99999

Please enter the port you wish to run your psyBNC with:

If the port is not use by other process it should be running and display that your psybnc running into process

If its used by other process it will give echo cannot listening to the port... please re-install your psybnc with other port

Note: howto connect to psybnc servers please use this link http://valueshells.com/psybnc.html .

 

Installing Bot In ValueShells:

$ getegg

Welcome to the Valueshells automated eggdrop builder!


This script will assist you with the installation of

your eggdrop. Should you have any concerns or questions,

please feel free to email support@valueshells.net or

message us at DALnet channel #Valueshells. - Thanks!


Press ENTER to continue

Press ENTER


1) Eggdrop's Nickname: (Put eggdrop nick, avoid using { or } char)

2) Eggdrop's Alternative Nickname: (Put eggdrop alternative nick)

3) Eggdrop's Real Name: (Put eggdrop realname, this is an username of the eggdrop)

4) Eggdrop's Port: (Put eggdrop port, this will be used for telnet or dcc chat)

5) Eggdrop's vhosts: (Put the vhost that are listed on http://valueshells.com/vhosts.html)

6) IP address of the vhosts: (Put the dns ip of the vhosts above)

7) Your nickname: (Put your nickname, it will be bot owner)

8) Main Channel of the bot (without #): (Put the base channel for the eggfrop)

9) IRC Network where the bot will join : choose number(1=IRCnet, 2=Undernet, 3=DALnet, 4=EFnet, 5=Webnet, 6=Others) (Choose the network)

DONE! the bot will join to the base channel, all you need to do next is /msg botnick hello and set the password...

You may add more scripts into it, just edit the bot config

 

To list files in the shell:

$ ls -al

This will print a list of files and directories.   It will look something like:

$ ls -al

bnc      eggdrop          psybnc            bnc.tar.gz       eggdrop.tar.gz

In the above example, 'bnc', 'eggdrop' and 'psybnc' are directories.   To navigate into those directories, see the next listing.

 

To navigate directories within the shell:

$ cd <directory name>

For example, if we typed 'cd bnc' it would take us into the bnc directory, from which there we can configure and compile the BNC program, among various other operations.

 

To navigate out of directories:

$ cd ..

Say we were in the 'bnc' directory mentioned earlier and we want to get back to our main directory.   By typing 'cd ..' it will take us one folder up the directory tree.   In this case, the command would take us back to our home directory.

 

To view processes on the shell:

$ ps x

This will print a list that looks like this:

$ ps x

  PID   TT   STAT       TIME COMMAND
32137   ??   ILs     0:00.00 ./psybnc
34061   ??   SL      0:00.01 sshd: user@ttypx (sshd)
34075   p2   SLs     0:00.02 -bash (bash)
34790   p2   RL+     0:00.00 ps x

This shows me that I currently have a psyBNC running.   To stop the process from running, I would use the 'kill' command, described in the next segment.

 

To kill a process:

$ kill -9 <PID>

Kill a process with the above command, substituting the <PID> from the listing you got from the command 'ps x'.   For example, if I wanted to kill the psyBNC above, I would type:

$ kill -9 32137

The shell will not echo anything back to you, and if you perform a 'ps x', the command should not be in the listing.

 

Editing files within the shell:

$ pico -w <filename>

AcmeShells staff suggest using pico as a text editor on the shell.   It is easy to use, and the main commands to using the editor are printed at the bottom of the screen when using the pico program.   Say I wanted to edit my BNC configuration file manually with pico.   I would cd into my bnc directory, and perform a 'ls'   I see there is a file named 'bnc.conf'.   This file holds my BNC configuration (names may vary from program to program).   To edit it, I would type:

$ pico -w bnc.conf

Pico will then launch and display the contents of the bnc.conf file.   You can edit it as you please, and then press CTRL-O to save the file, and then CTRL-X to quit pico.   The basic commands for using pico can be seen at the bottom of the shell display.   You can also create new files with pico as well, by launching 'pico' and saving with your desired filename.

 

To create a folder within the shell:

Directories can be made within the shell using the 'mkdir' command.   For example,

$ mkdir myfiles

will create a directory named 'myfiles in your present directory.

 

Removing directories within the shell:

To remove an empty directory within the shell, use the 'rmdir' command.   For example,

$ rmdir myfiles

Keep in mind that this will only remove the directory if it is EMPTY.   If the directory contains files, and you want to delete all subfolders and directories under it, read on.

 

Removing files and non empty directories within the shell:

Files can be removed with the 'rm' command, as with non empty folders.   To delete a single file, type:

$ rm notes.txt

This will delete the single file, 'notes.txt'.   To delete a directory with files and folders within it use this:

$ rm -rf psybnc

This will remove all files in the 'psybnc' folder, along with the folder itself.   The options tell the shell to delete files recursively, and to not prompt you for removal.

 

Copying files within the shell:

To copy a file, the 'cp' command can be used.   Example:

$ cp eggdrop.conf /home/username/eggdrop/eggdrop.conf

This will copy the eggdrop.conf in the directory you are currently in, into the eggdrop directory that you specify (/home/username/eggdrop)

 

Viewing vhosts within the shell:

To view a list of vhosts on the server you are on, simply use the 'vhosts' command:

$ vhosts

This will print a list of vhosts that are available to your server, with both the host name and IP.

 

To IRC from the shell:

You can connect directly to IRC from the shell.   The most common client is BitchX.   To connect to IRC using BitchX, use the following command:

$ BitchX -H xxx.xxx.xxx.xxx irc.server.here

Where the xxx.xxx.xxx.xxx is the IP of the vhost you want to use (viewed by command 'vhosts'), and the address of the IRC server in place of 'irc.server.here'.

 

Downloading files to the shell:

To install software on your shell, such as psyBNC, you will need to fetch the sources for it before you can build it.   To download software to the shell, you can use the 'wget' program.   For example,

$ wget http://some.site.com/source.tar.gz

Will download the file 'source.tar.gz' from the server some.site.com into the current directory.

 

Dealing with compressed file formats:

To extract files from a tar.gz archive, cd into the directory containing the tar.gz file and use the command:

$ tar zxf source.tar.gz

This will extract all files from the archive source.tar.gz.

 

To extract files from a .tar archive, cd into the directory containing the .tar file and use:

$ tar xvf source.tar

This will extract all files from the archive source.tar.

 

To extract files from a gzipped archive, use:

$ gzip -d source.gz -or- $ gunzip source.gz

This will extract all files from the archive source.gz.

 

To extract files from a bzipped file, use:

$ bzip2 -d source.bz2 -or- $ bunzip2 source.bz2

This will extract all files from the archive source.bz2.

 

Compressing a directory into a .tar.gz file:

To compress a directory full of files into one smaller, more manageable .tar.gz file, cd into the directory you want to tar.gz and use the command:

$ tar -zcf myfiles.tar.gz *

This will create the file 'myfiles.tar.gz' from your current directory.