It is considered that Linux is very hard to learn. In a certain point it's true. Why? Because Linux is other than Windows - these are two absolutely different operating systems. Remember the first time when you saw the computer with windows? I don't think it was easy for you to get used to it. You'll have to learn how to use Linux from the very beginning, and that's why it's hard, just like the first time you saw computer.
This quite short article will only introduce you to Linux, you'll learn here only what is needed, for the beginning (though a lot of people managed to learn it without any helping manuals).
Now I guess you are a newbie right now, otherwise you won't read it. 'Kay. you have to choose a Linux distribution, as there's a lot of them out there: OpenSUSE, Mandriva, Debian, Ubuntu, Slackware, Arch, Gentoo and many other. What shall I recommend to you? I'll strongly recommend to you you use Slackware. Not just because I like this distribution, but because it's the most logical choice there. First of all: what do we want, in the way of a hacker? Understanding the System. I'd better stay out of philosophy right now, so let's speak about computer system.
Why can't we reach full understanding of operating system with Ubuntu, OpenSUSE, Mandriva, also Windows? Because this are so-called "clicking" distributions: here you use your mouse, you click the buttons, and the program is configuring everything for you. This have its advantages for a office use, but not for us: like I said, we want to understand how system works, which is too hard when everything is done by computer, and secondly, automatic configuration produces an errors, and skips them, without proper solution. This leads user to different kinds of errors, malfunctions. In Windows - to the Blue Screen of Death. That's why Slackware brings you combination of opportunity to learn Linux and stability.
There are some other advantages of using Slackware, for example it's not a commercial distribution, which doesn't lead us to the problems with copyrighted software, like mp3 and video codecs. No matter what others say, Slackware is easy to use. It has nice tools for system administration, which allow you simple network configuration, package administration e.t.c. You can change Slackware to whatever you want, once you'll become more advanced in this stuff.
These are some of a reasons, why I use Slackware, and why I recommend it to you.
Alright, enough Slackware propaganda, let's get to work. I will not tell here about specific distribution tools, I'll tell about basic things in Linux. If you want more information on Slackware, check out main web of Slackware: http://www.slackware.com or download the Slackware book: http://www.slackbook.org .
1. Linux filesystem
We know, in Windows, to each partition are assigned letters (C, D e.t.c.). These are starting directories. In Linux it's different: there's only one starting directory, marked with "/", named 'root directory'. If we'll take a look at the files in / directory, we'll see here directories like etc, bin, home, usr and others. Each of them have it's own function, and each of them can be placed to the different partitions. Can you imagine C:windows and D:windowssystem, being on the same machine?
For the partition to be accessible, it must be mounted. The system must be "told" the device, where the partition is situated, and the directory where it's files will be listed - a so called "mount point". To better understand this kind of stuff - we installed Linux, we had two partitions. One was clean, another had Windows. We installed Linux on this clean partition. Now, when we launch Linux, this partition is a root partition - /. We want to make our windows partition make accessible. We have to mount it. In the special configuration file (/etc/fstab) we input the device of this partition, for example, /dev/sda1 (we'll talk about devices later), a mount point - /windows, a file system - ntfs, and few other parameters. After we mount it with a special command, in our root directory we'll have a windows directory. If we open it, we'll see contents of a windows partition.
Also, as you might have guessed, we use frontslash / in linux, instead of backslash, used in windows. New users should remember, that Linux is case sensitive. If we want to access file /home/user/Desktop/document, we must write the address like that, and if the address will be /home/user/desktop/document, you'll get the error message.
Now let's take a look at the directories in the /root partition. If we'll take a look at the / directory, we'll get at least the following:
Each of these directories have their own purpose. Let's take a look at some of them.
/bin - contains executables, used both by administrators and unprivileged users. There are such executables, as "bash", "cp", "ls", "mv".
/etc - contains configuration files of your system
/lib - here are all shared libraries, required by different programs
/mnt - a mount point for different media. however, it can be changed
/proc - the /proc filesystem is a pseudo-filesystem, that, in fact, doesnt exist on any particular media, but in the virtual memory. It's purpose is to mantain dynamic data of your system.
/sbin - contains executables used for system administration
/usr - probably most important system directory, asit has all user executable files. support libraries for X are also kept here.
/boot - contains files used by bootloader, and a linux kernel
/dev - in linux, everything is files or directories, which means devices are also files - you can get data from devices (equivalent to reading files), and send data to devices (equivalent to writing files). For example, cdrom file represents you cdrom device, fd0 - your floppy reader. A very bright example is /dev/dsp - a speaker. You can write to this file, and you'll hear a sound - data are sent to the sound card. For example, you can "listen" to linux readme file, by inputting the following command: cat /usr/src/linux/README > /dev/dsp .
/home - in this folder are created user folders - each user has full write permissions to his folder. User configuration data are stored here.
/opt - this is a directory for installation of a software, that's not the part of a default installation
/root - a home folder of a user root
/tmp - directory for a temporary files
/var - contains such things as received mail, different system logs e.t.c.
2. Commands
Now that you know general things about filesystem in linux, let's now take a look on how can we manipulate with files and perform different tasks under Linux, yet, not using graphical environments. Now, we will learn some things about linux commands.
I'll write here main commands and explain what do they do, and how to use them.
cd <location> : command for changing current directory. you can input absolute path, for example /home/user/Documents, or relative path: Documents (assuming your current location is /home/user). to change location to the upper directory with a relative path, just input location ../ (e.g. cd ../)
ls <location> : command for listing files in directory. you can input just ls, so files in the current directory will be listed, or you can input absolute path. Another thing to mention are wildcards, for particular file matches: if we input command ls /usr/bin/p*, we'll get listing of all files, whose filenames are starting with p, if we input ls /usr/bin/*yt*, we'll get all files, whose name have yt. Here, wildcard * means "any".
cat <filename>: command for displaying file. you can input relative path of a file, you want to display, or a full path to a file. This thing is good, if your file isn't big, as you won't have possibility to scroll through the console output always, I'm talking about text mode now (we'll talk about it later). In case you want to view bigger file, you can use "more": for example, more /usr/home/tetxfile. textfile will be displayed in something like pages - press spacebar for next page.
mv <oldlocation><newlocation>: moving files. first input oldlocation of the file, then input location location of a new file. Locations can be relative. Exmaple: mv /home/user/doc1 /home/user/newdoc. mv is also used for renaming files.
cp <oldlocation><newlocation>: works like mv, except it leaves oldfile, and in a new location, creates a copy of a file.
mkdir <location> : will create new empty directory
rm <filename> : will remove file. Just remember, that it doesn't remove directories.
rmdir <param> <directory> : without parameters, will remove directory, if it is empty. If directory is not empty, use -rf parameter. Use with caution.
clear : if you got too much garbage in your console, you can clear it with this command.
man <command> : get detailed help on using a recent command.
nano <filename> : nano is a basic editor for linux. You can open existing files with it, or create a new files, by inputting a unique filename. Once nano is opened, you'll see possible options in the bottom of a screen. ^ means Ctrl button.
vim <filename> : advanced text editor. you can edit existing file, by inputting it's name after command, or create a new file, by inputting a unique filename. Once VIM is opened, press I to start editing. You can get VIM command line at any time by pressing Esc + :. To write a file, input w!, to quit q, to quit without saving use q!. more info in the VIM documentation.
./<filename> : with this command, you can execute file. For example, you got a script shell.sh, and you want to execute it. Type ./shell.sh to execute it. Filename path can be absolute or relative. Note that to execute files, they must have execute permission. See chmod.
chmod <parameters><filename> : change permissions of a file. You can define what permissions you are giving to a file with parameters. Here are some of them:
400 read by owner
040 read by group
004 read by anybody (other)
200 write by owner
020 write by group
002 write by anybody
100 execute by owner
010 execute by group
001 execute by anybody
lynx <url> : though, this program isn't installed in every distribution by default, I'll mention about it, as it can be very useful sometimes. lynx is a text web browser, it doesn't show images. It doesn't support frames or tables, it's a very simple text browser.
links <url>: another textbrowser, but a little bit more advanced. it supports tables, and have some useful functions.
3. Text mode, X Window System and KDE
First of all. Normally, there's a text mode, where instead of pixels are used symbols - text. Of course, here you can't see any graphics, which means you can't view images, you can't launch application that are created for a graphical mode. However, textmode is good for a specific work. For example, you'll really appreciate a black background with a gray text on it, when you've been working with a code the whole day and night.
When you are in text mode, you can switch between virtual console using Alt+F#, where 3 is a number of a virtual console (1-6). You can do some configuration using command setterm. You can get more information on using this command simply by inputting it without any parameters, or, for more advanced help on the command, see man pages (command "man setterm").
To switch to a textmode when you are in graphical more, use command "telinit 3" (for this, you gonna need root privileges). To get back to the Windows System, input "startx".
Now let's take a look on the X Windows System. Like it is written in Wikipedia, "the X Window System (commonly X11 or X) is a system which implements the X display protocol and provides windowing on bitmap displays. It provides the standard toolkit and protocol with which to build graphical user interfaces (GUIs) on most Unix-like operating systems".
X Windows System is provided by the X Server. I wouldn't better explain now the configuration of an X Server, usually it is configured automatically. To launch an X Server from a textmode, input command "startx". Here will be launched default graphical environment, that you've probably selected during installation. Here comes X, differences between distributions, here come problems. Different distributions have different configuration tools, different default graphical environments. Better take a look at your distribution manual to see, how to change configuration of different X stuff.
In the beginning of this article I was talking about Slackware. In Slackware, the main graphical environment is KDE. Currently, KDE is most popular graphical environment (second most popular is GNOME), and it is known as easily-configurable environment. Here, you don't need to change any configuration files manually, but you can use such a things, as Control Center and others. Let's take a brief look at the main applications in KDE.
But before we do, I would like to mention that you can execute programs quickly, by pressing Alt+F2, and inputting a command.
Konqueror (execution command: konqueror) : a multi-purpose program: a file manager, a web browser. Has built-in KIO, for support of such things, as FTP.
Kwrite (command: kwrite) : a simple KDE text editor.
Kopete (command: kopete) : a KDE communication program, supports such protocols as ICQ, AIM, Jabber, Yahoo, IRC and some others.
Konsole (command: konsole) : terminal emulator for KDE
You can find a lot more K applications, by looking at the K Menu.
############################################
Further reading:
Slackware book - http://www.slackbook.org/
Linux shell programming - http://www.freeos.com/guides/lsst/
Other free books about Linux - http://www.linux.org/docs/online_books.html
Cast your vote on this article *Note: the order of the votes has been reversed.
Comments: Published: 28 comments.
By: omniwrath540 - 04:21 pm Tuesday April 15th, 2008
Pretty good article, lots of information, really lived up to its title. However, my biggest critique is that you should remember to proof read your article for spelling and grammar mistakes. There were more than a fair few.
I did like how you explained the different directories in the root folder, as well as the KDE and textmode sections. For the chmod numbers, I may be wrong, but I believe there are more. For instance 777 and 666.
Also, following your statement about slackware being better for a hacker, if you want your linux for the sake of hacking, then BackTrack really dominates. Just because of the pure number of pre-installed programs and hacking tools. But I agree that slackware is a good linux, but you cannot call it the most "logical choice", as there are many, many, many linux distro's that can fit any purpose.
If anyone reading this is new to linux, here's a good link for linux commands: http://www.ss64.com/bash/index.html
Good article, although i disagree with you on the slackware, granted i havent done a whole lot with linux, but you talked about the difficulty of switching from windows to linux, my opinion is it would be easier for people to transition to linux using fedora, ubuntu or some other form of linux that is still very much linux in how it operates, but still has some familiarity in that you can at least see the options you can do easier then with a text console, and im not saying anything bad about slackware
just my oppinion on the "transition"
omniwrath540: yeah, there are more numbers in chmod, and some text modes, i just didn't want to make it too much complicated, as, after all, it's for beginners.
Then, talking about distros (I'll try not to start holy war here :D): backtrack (which is slackware based, btw) is good for hackers - it's a slax distro with lots of hacking tools. But these tools are nothing, if you don't know such things as networking, some programming languages e.t.c. For learning, backtrack isn't too wise choice, also, it's quite buggy, and i don't think it's a good idea to use it as an operating system.
The_Computer_Wizard: yeah, I agree slackware might be too hard for beginners, i also started with Mandriva, and then, after switching between ~10 distros stopped on Slackware.
But now, I honestly prefer editing configuration files in VIM rather than clicking...
Great article,good job!!!!
10/10!!!!
well explained man keep the good work....
By: omniwrath540 - 09:52 pm Thursday April 17th, 2008
I meant only using Backtrack as a liveCD, the way you use Knoppix. But there are several other linux distos designed specifically for hacking, although Slackware does give you a very good feel for your computer and how linux works. I've heard good things about DEFT and nUbuntu linux, both derived from debian linux, which is easier for beginners to start with. Just wandering, has anybody tried Dream Linux? I thought it looked a little to windows-ish but I've seen some good reviews.
Nice article, to be honest there was that confusion of 'what do these folders mean??' lol. going to read it again tomorrow to remember better, since I'm tired now :)
Anyway this is a forensic live distro (used by the belgian cops lol)
http://www.lnx4n6.be/
I don't have any spare cd's so I haven't been able to try it out though.
snackhack: It is not the operating system that makes the Hacker. These days, you can get almost any Linux tool for Windows (using things like VMWare) so no, it is not *needed* however, many servers are run using Unix and Linux based operating systems so knowledge about Linux will certainly help.
This was a fairly good article and great for beginners. 8/10
is there a live CD version of slackware? my current OS is xp and i would prefer to keep it and only use the slackware as live CD.
By: darkprince117 - 06:17 pm Wednesday June 18th, 2008
Is it bad to use Ubuntu for hacking? I mean we can still use the terminal...I don't have any experience in text-only OSes so I think it's a huge jump to go from Windows XP. I'm a newbie, as you can tell. =(
By: c24lightning - 04:21 pm Thursday June 19th, 2008
As the first comment said, you missed a good few of the chmod properties, such as 777, 775, 644, 664, 700, 600, 666, etc.
0.0 i'm going to change one of my computers over to linux (windows is horribly for any and all sensitive information, or if u just don't want to deal with a LOT of virus's)
but i'm going to be using it mainly for learning how to hack, i still want to get a feel for linux before i go full line by line.......... which is what slackware seems like to me, are there any easier (but not windows) OSes that i could go for?
c24lightning- wtf r u restating it....... it's been said (just my 2 cents)
By: lereveur - 12:14 am Wednesday August 20th, 2008
I started out on DOS and Q-basic, but never made it too far (you know, programming basic text, a few loops, navigating, making batch files, searching for files, basic input, etc.), and then moved up to windows. I can make very basic sense of html but can't write or type any programming language all too fluently. From what I can see, slackware operates like a SUPER version of MS-DOS. Am I wrong in thinking this?
And from that perspective, would it be too difficult to start up on linux with slackware or something similar? Honestly, I miss the days of DOS when everything was nice and simple, and I wish I had the knowledge to get a BBS up and running of my own (if only to play LORD and BRE).
Can some linux-enthusiast pm me and establish some sort of correspondence to walk me through getting started on it?
By: webdracula - 04:38 am Friday August 29th, 2008
good one. Looking forward for your next article.
By: h4r5h4 - 05:09 am Saturday September 06th, 2008
nice for linux noobs
forgot to mention
www.tldp.org
nice site and lot of documentation
By: macoafi - 01:12 pm Saturday September 13th, 2008
@darkprince117:
I use Ubuntu. Nothing wrong with that. I think the author is wrong to say that you can't learn Linux if you use a GUI-oriented distro like Ubuntu, especially since he or she then said to install KDE on Slackware. At that point, what's the difference? You can use whatever distro you want and still edit config files manually all you like. Learning multiple distros is good, though, since they do things differently. Debian & Ubuntu users might not know about /etc/sysconfig in Red Hat, and Red Hat users wouldn't know all of the dpkg tricks. Learn how to use many distros.
By: macoafi - 01:15 pm Saturday September 13th, 2008
Oh, and Ubuntu was the first distro I really learned my way around. It's still my main distro. Having a job as a Red Hat sysadmin will force you to learn about non-Debian-based systems though. Being an Ubuntu user doesn't mean I can't use the terminal. I usually do. If you want the system to work so you have a known-good state from which you can break it and to which level you an re-fix it, that's good, in my opinion.
By: WHITE__HAT__ - 08:33 pm Sunday September 14th, 2008
About chmod you have to understand that linux permission are disritbuted to rwxrwxrwx so the numbers would be in binary for every rwx if i want it to look like this r---w---x then i would write chmod 421 it is simple binary every rwx are a number
By: Elligari - 10:54 am Tuesday September 30th, 2008
Test command for
http://www.hackthissite.org/pages/bugManagement/index.php?strAction=View& ;intBugID=2706
Also, great article mate :)
By: gmbatman - 02:04 pm Tuesday October 07th, 2008
Beautiful info for the very basics. Would have loved to learn some of the pseudo and root commands though they are for advanced users, I can see why they were left out. Excellent basics guide keep up the good work!!
This site is the collective work of the
HackThisSite staff. Please don't reproduce in part or whole without permission.
Page Generated: Sun, 12 Oct 2008 23:49:24 -0500 Exec:
9