Home
joes polls
people i know
hate mail
napster
icq
a lil bit about me
school diss
links
system of a down
list of hackers
my tatoo
what people say oline
unix codes
will you be killed
sub7
diablo
SUCKING SITES
GOSSIP BOX
CHINESE ASTROLOGY
the history
FREE PORN
passwords
MS-DOS
MS DOS prompt code 1
cult of the x
projects
join the cult
members
sub7 news
hacked diablo
diablo passwords
|
1] Introduction
Welcome to nix commands by Virtus, i wrote this text because almost every newbie is very anger to start with Unix (or nix in general) but doesn't know where to start, i always direct them to servers like nether.net where they can get there free shells and stuff.. But they can't do anything there once connected, they don't know the commands, i wrote this to learn them the commands. After all everybody has to start somewhere.. If this is too easy for you i recommand you to read the follow up "shells", by Urbz and me.
2] Nix
The commands work on all *nix systems, which means that you can use these commands on unix, linux, irix, etc. etc. We will start with the commands in a moment, but first of all i would like to explain what nix is, and how it generally works.
Nix is an operating system, it handles everything, e.g. it let's you run programs or thing like a shell (next chapter). But why is unix so special, why not jsut use windows? Well, if i ask that question to someone who uses unix i get the same reply everywhere. I was sick of microsoft, i couldn't configure the things the way i liked it, and unix is just better.
A big advantage of nix is that it's very secure, and that it's really made for networks(it's a multiuser OS). So if a unix computer has the telnet server (telnetd) on, you will be able to connect to that computer.
3] Shell
The shell is where you can give your commands to the os, if you want more info on shells i advice you to read "shells", by me and Urbz. But what you need to know is that it handles all commands; you type a command, and it runs the program that you wanted to use with that command. Most commands are little programs, like ls, but other commands like cd are build in the shell.
4] Users
Finally we're going to start with the real commands, we are going to make ourselves a command on our new linux system. You have to be root for that. Root is the superuser, he can modify anything he wants to. All what a hacker wants is getting root when you're not supposed to. Hacking generally is "getting root".
We are going to add the user 'virtus':
"useradd virtus"
Now, the user 'virtus' is added, but you haven't set a pass up yet, to do that type:
"passwd virtus"
Give it the pass, and you're added to the password file in /etc/passwd, you can now login as virtus. Now also the directory /home/virtus is made, only root and the user virtus have access to that directory. If we want to delete the account virtus again we just type:
"userdel virtus"
Now the account is deleted.
5] Navigating and controlling
We can't do anything yet, it gets fun when we can navigate thru our system and explore it. We also have to be able to control it, e.g. To make, move, copy and remove files.
NOTE: to execute a file type:
"./filename"
5.1] ls
'ls' stands for 'list', if you type it you get a complete list of all files in that directory you're in.
'ls' has many options like 'ls -l' will give you a "long list", go here to learn howto view the manual pages of ls.
5.2] touch and mkdir
When you login you get in the directory / if you type ls you can see that your home folder contains nothing yet.
We're going to make a directory in / with this command:
"mkdir code"
When we type ls now we can see the folder code in / we also want to make a little file in our home dir.
Type:
"Touch me"
I know touch is a pretty weird name, but that's jsut the way it is.. If we type ls now we can see the folder / contains two things:
The directory 'code', and the file 'me'.
5.3] cd
Now we want to have a little look in the directory code, type:
"cd code"
To go to that folder. If you want to get back to the parent directory type:
"cd .."
Now you're back in / but we didn't know how to do that yet.
Now we are going to make a copy of the file 'me' in the folder 'code' by typing(from /):
"cp me /home/virtus/code"
Now we copied it, always remember the syntax of cp:
"cp [SOURCE FILE] [DESTINATION FILE/DIR]"
5.5] mv
Suppose we don't want to copy, but move the file 'me' to /home/virtus/code, do to that we type:
"mv me /home/virtus/code"
And again, remember the systax:
"mv [SOURCE FILE] [DESTINATION FILE]"
5.6] rm
Now we have enough of that stupid 'me' file.. We are going to delete it, just type:
"rm me"
when you're in the correct dir and it will be removed. If you have to file e.g. Virtusrox and virtusisverycool, you don't have to type the whole filename, you can type rm virt* and it will delete all file starting with virt. You can also do rm *, it will delete everything.
Now that the folder code doesn't contain anything we want to delete that too. Do delete that type:
"rmdir code"
When you're in the parent folder, now the dir code is deleted.
5.7] pwd
With pwd you display the dir you are currently in. So when you're in /home/virtus it display's that.
This is called the working directory.
5.8] echo
Echo is used to display the keyboard input, this is very much use in shellscripts. Another usefull thing you can do with echo is displaying the contents of a folder.
Example:
$echo /mnt
/mnt/doswin /mnt/cdrom /mnt/floppy
5.9] find
To find a file you just use the simple command "find . -name filename", you can also use the *-sign, here's an example:
"find . -name file*"
It will now look for all programs that start with 'file'.
You can also look in different directories:
"find /home/virtus -name file*"
You can also look for files that are changed within a certain time:
"find / -type f -mmin -10"
It will look for all files (from /)that were changed in the previous 10 minutes.
Another option is looking for all files owned by a certain user:
"find / -user virtus"
It will now look for all files (from /) owned by the user virtus.
5.10] locate
With locate you look for specific files in the locate database located in /var/lib/slocate/slocate.db, this contains all files, dirs and subdirs on your system that the program 'updatedb' found. If you run locate but you've never run updatedb nothing will happen, so you will have to do that first.
5.11] ldd
This is used to view the shared libraries used by a command or program, here's a little example:
"ldd /bin/rm"
Now you look for all shared libraries used by the command rm located in /bin.
6] The gnu tools
GNU stands for .... and started in 1984, the organisation developed alot of programs that are common used on linux and other nix systems. I will now handle the most used gnu programs.
Another example of a much used gnu tool: emacs, will be handled in the text editors chapter. More info about GNU can be found at www.gnu.org .
6.1] GCC
Gcc is a compiler, gcc stands for GNU C Compiler, but you are able to compile C, C++, Java, Fortran, Chill and ASM with it.
The compile uses all GNU libraries, like glibc and glibc++. I will now give a brief explanation of the commands, if you want more read the manuals.
To compile a simple file (the extension can be anything, e.g. .c, .cpp, .asm, .o etc.) type:
"gcc -o file file.c"
The compiler will now create an executable file called 'file'.
You can also include libraries and other things.
Example:
You want to make a little KDE application and you're doing it with the QT libraries located in /usr/lib/qt, you have to tell that to gcc:
"gcc -I$QTDIR/include -L$QTDIR/lib -o qt_app qt_app.cpp -lqt"
What you did was telling gcc to use the libs and includes in QTDIR, you can just ype "QTDIR" because QTDIR is defined in bash as /usr/lib/qt.
If you want more information got to www.gnu.org/software/gcc/gcc.html .
6.2] GZIP
Gzip is another GNU tool, it stands for gunzip, what it does is compressing files. When a file is compressed it has the .gz extension.
You can use gunzip in combination with tar, so most compressed files have the .tar.gz or .tgz extension. Another option is .tar.bz2 (bunzip).
To unpack a gzipped tarball (a .tar.gz file) you type tar -xvf name.tar.gz, tp unpack a bunzipped tarball (a .tar.bz2 file) you type "tar Ixvf name.tar.bz2
You can find more info about gunzip by clicking here
6.2] GNOME
GNOME is the GNU linux GUI (graphical user interface), it's the x window system interface used by alot of unix spieces.
To start x window system (not x windows, tha reminds too much to windows), you only have to type one command:
"startx"
Now you will start x window system(in this case gnome, depends on your unix spiece/linux distribution).
You can find more info on gnome.org .
7] Chmod and Chown
In chapter 2 i told you about the advantages of unix, one was the security. Chmod and Chown are very important programs used for unix security.
That's because they handle the filepermissions, which will be handled in the following chapter.
7.1] File permissions
Every file on a UNIX variant has permissions. Since Unix is a multiuser operating system, every file needs to have permissions so that Unix will know who is the owner of each file, and who allowed and not allowed to read/write/execute it.
This is why there are permission bits. When you set a permission for a file, it can be readable using the ls -l command, each file has a 10 letter field that looks like this "----------" and that field shows the permissions for each file. The first field, is saved for an ID. If it says 'd' , then it's a directory. If it says `c' , then it's a block device driver. If it says "-", then it's a normal file. If it says `l' , then it's a symbolic link. The first field can not be set manualy, and is automated.
After the first field, there are 9 more that you have to divide in parts, each division has 3 letters, and symbolises something else. The first division, called the user division, is the permissions the file owner has on the file.
The second division is the group division. It symbolises what permissions the owner group users has on the file. And the last division, called the other division, is what permissions all other users have on the file.
Each letter stands for something else: r - Read permission (the permission to read from the file) w - Write permission (the permission to write to the file) x - Execute permission (the permission to execute the file)
For example, if the file has the following permissions: -rwxr-xr-x It means that the owner has execute, read & write permissions for it, and that the owner group users can only read and execute it, and that the rest of users can only read and execute it too.
7.2] Chmod
To change file permissions you just type: chmod \ The chmod program calls the file, and changes it permissions as needed. Before you change permissions and modes, you must know what you are doing.
The permissions are as following: 0 - No permission 1 - Execute only 2 - Write only 3 - Write & execute 4 - Read only 5 - Read & execute 6 - Read & write 7 - Read, write & execute. The chmod command to change permissions is built like that: chmod ### Instead of the pound signs there are supposed to be numbers.
Each number represents a different division, the first is owner, second is group, third is other users. Let's say you have a file called `only_for_me.doc' , and you don't want anyone to look at it, besides you. You could execute the following command: chmod 600 only_for_me.doc.
That would let you read & write permissions on the file, and all other users were getting a message like this when trying to do something with it: bash: only_for_me.doc: Permission denied.
As you can see, the file is now secured. But what if you had a file called cool.prg and it's a neat game, you want everyone to see? remember, you don't want them to edit the file, just use it. You would use the following command to do so: chmod 755 cool.prg.
That would set the file so that you can edit it, but other group members and other users can only execute and read it. Again, this is pretty secure. By using chmod you can also change global permissions on a file.
Let's say you want to make it executable by everyone. You would use the following command to do so: chmod +x neat.file That would set execute permissions on each one of the file divisions. The modes for this command are as following: +x - Adds execute permission to the file. -x - Removes execute permission from the file.
+r - Adds read permission to the file. -r - Removes read permission from the file. +w - Adds write permission to the file. -w - Removes write permission from the file. Note that there are more flags for the chmod command, and that you can use the full path shortcut here too. Also notice that only the file owner can change permissions to the file.
8] Others
In this chapter i will handle a few other commands, that are essential for good unix use.
8.1] Mount
To view the contents of something like e.g. another harddisk or a floppy we first have to 'mount' it, this means we make it suitable for the unix platform so that we can view it.
Say we want to view our windows partition, that is defined in fstab as "/windows/C" you just type:
"mount /windows/C"
But if it isn't defined in fstab you but you do know the partition label (e.g. hda3) you just type:
"mount /dev/hda3"
Now you can view all contents of hda3.
It's also possible you want to go to your floppy, to mount your floppy type:
"mount floppy"
When it's defined in fstab, when it's not defined there type:
"mount /dev/fd0" or "mount /dev/fd0 /mnt/floppt -t vfat"
If you go to when you used the first way you can view it in /floppy, when you used the second way you can view it in /mnt/floppy.
You can mount your cdrom by doing this:
"mount cdrom"(when it's defined in fstab) or "mount /dev/cdrom /mnt/cdrom"
8.2] Screen options
When you have a filled screen but you want to clear, it you have to type one simple command:
"clear"
And all done, you have a clear screen now with only a prompt.
When you regret this action just type 'reset' and everything is set back again.
8.3] Manuals
Every command has it's own manual, to view this just type
"man command"
And it will give you a manual page from that command, this can be very handy if you want to know more of the options coming with e.g. gcc or gunzip, you can also just view the manual page from ls or cp.
When you're in X you can also type "xman command"
8.4] Text editors
A must for everyone is a text editor, you have to use it for alot of things. Ofcourse you can't use winword, because that is for windows, but WordPerfect(corel.com ) can can be used on linux.
You can also run the text editor that comes with your GUI or unix form.
When you work in a not-graphical environment there are four most used editors:
-pico
-emacs
-vi
-joe
8.4.1] Pico
Pico comes with the packet 'pine mail', this text editor is very simple. When you start pico up with the option -m you can even use your mouse. For this type:
"pico -m FILENAME"
In case your system crashes when you're working on a pico file it will be saved with the .save extension.
Pico keyboard commands:
CTRL+D (^D) -- Delete character that the cursor stands on
CTRL+K (^K) -- Cut the line that the cursor stands on
CTRL+E (^E) -- Goes to the end of the line
CTRL+A ( ) -- Goes to the beginning of the line
CTRL+R (^R) -- Read a file
CTRL+V (^V) -- One page down
CTRL+Y (^Y) -- One page up
CTRL+U (^U) -- Paste text(after using CTRL+K)
CTRL+X (^X) -- Exit pico
CTRL+T (^T) -- Start spelling check
8.4.1.1] configuring spelling check
Start the program pine mail by typing 'pine' after the prompt. Now you will get the prompt "Choose a setup task from the menu below", type 'C' to start the Config option.
Go thru the configuration list until you get the line
"speller = [No Value Set]"
Select this line. Now press 'C' again to change it. On the bottom on the screen you will now get
"Enter the text to be added:"
Add the path to the spelling checker ispell (/usr/bin/ispell).
Now press enter and after that type 'E', it will ask you if you want to save your setting, aswer with 'Y'. Now press 'Q' too exit pine. Now you can use CTRL+T in pico to run the english spell check.
8.4.2] Emacs
Emacs has a long history, the name stands for Editor MACroS, and was desgned in late sixties. It is made in the programming language Lisp, which is not very well known.
To start emacs type:
"emacs -q filename"
The option -q let's you use .emacs form your home dir, which is very usefull for beginners.
Here is a table with the commands for emacs:
CTRL+E -- Go to the end of the line
CTRL+A -- Go to the begin of the line
Alt +f -- Next word
Alt +b -- Previous word
Alt +e -- Go to the end of a sentence
Alt +a -- Go to the begin of a sentence
Alt +} -- Go to the end of a alinea
Alt +{ -- Go to the begin of a alinea
CTRL+D -- Delete the character where the cursor is on
Delete -- Delete character
Alt +d -- Delete word
CTRL+K -- Delete line
CTRL+X(/C) -- Exit emacs
CTRL+H, b -- Show table with all commands
CTRL+H -- Ask online help
8.4.3] Vim
Vim stands for Vi Improved, it's the better version of Vi. To run vim just type 'vim yourfilename' after the bash prompt. When the file exist it just opens it, when it doesn't it creates it.
When vim is started you can't input text right away, you must first give the input command ('i'), when you're done with the input you have to press ESC to exit the input.
I will give you a short example:
$vim myfilename
i (input command)
This is my little text file.. Do you like it?
ESC (exit input)
:wq (exit vim)
These are all commands you can use with vim:
i -- input text before the cursor
I -- input text in the begin of the active line
o -- white line after active line
O -- white line before the active line
a -- input text after the cursor
A -- input text at the end of the line
x -- delete the character where the cursor is on
R -- change the text
d -- delete the sign where the cursor is on
dd -- delete the line where the cursor is on
dw -- delete the word where the cursor is on
u -- undo changes
:q! -- quit vim without saving
:wq -- quit vim and save changes
When you want to learn more about vim you should read the program vimtutor.
If you want to know more about vim click here .
8.4.4] Joe
The joe editor exists in 5 different versions:
rjoe -- restrcited joe
jpico -- acts like pico
jmacs -- acts like emacs
jstar -- acts like Wordstar
joe -- the real joe text editor
Here's a table with all commands for joe:
CTRL+E -- Go to the end of the line
CTRL+A -- Go to the begin of the line
CTRL+X -- Previous word
CTRL+Z -- Next word
CTRL+U -- Next screen
CTRL+V -- Previous screen
CTRL+D -- Delete character
CTRL+W -- Delete word
CTRL+Y -- Delete line
CTRL+J -- Delete line from cursor to the end
CTRL+K, X -- Exit joe without saving
CTRL+C -- Exit joe and save changes
CTRL+K, H -- Ask online help
Other then pico, you can use multiple windows with joe, to change windows use:
CTRL+K, O -- Split screen
CTRL+K, P -- Upper screen
CTRL+K, N -- Bottom screen
9] Shutting down
This command can only be executed by root and has two different options; reboot, and shutdown.
9.1] Shutdown
The first option used with shutdown is '-h', if you use this option the system will shutdown. After this option you have to add another thing; when..
So if you want to shutdown now, you type:
"shutdown -h now"
You can also choose to shutdown in say 15 minutes:
"shutdown -h +15"
You will now get a warning message that the computer is going to shutdown in 15 minutes.
9.2] Reboot
The second option is '-r', when you do this you will reboot the system. And again, you can use different times.
9.3] ps
When you shutdown, you have to kill all processes first, the commands shutdown tells nix to do that. You can view those processes by the command 'ps' which stands for 'processes'.
To look at all processes type:
"ps ax"
You will now get |
|