Linux for newb

Talk about anything else you want

Moderator: BigEvilCorporation

Post Reply
KanedaFr
Administrateur
Posts: 1150
Joined: Tue Aug 29, 2006 10:56 am
Contact:

Linux for newb

Post by KanedaFr » Wed Aug 10, 2011 9:26 pm

Hi,
I'll soon need to configure a small linux machine.
Unfortunatly, Linux and its file system is a mystery for me.
Where do I modify what is ran at startup ? Where do I put my custom program ? Where should I save my config for my program and the working files ? Where do I configure my machine name of the network and its shared folders ? Why is it different on Debian, Fedora and others ? Why apt / rpm / ... or what ever is called the package installer ?
On top of that, the user vs root is still too much for me : why not boot on root mode everytime ?

So, this to ask you if you know a book (err...ebook would be better) explaining the basic of Linux CLI (not GUI)
since my distrib will propably by Damn Small Linux, it should be Debian oriented... (and yes I saw the DSL book...looking for it!)

thanks

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Wed Aug 10, 2011 11:13 pm

Well, this is for xubuntu (which is great as a small linux distro), but is relatively the same for most distros.

General filesystem hints:
/ = root, the base of everything
/boot = where all the boot files for grub or lilo go
/etc = a lot of system config stuff is found here
/dev = all your computer devices
/home = all users will be found here
/media = the place all your removable media will be found
/usr = programs, data, libraries, etc for ALL users will be here
/dos or /windows = if you have a windows or dos partition you set to be mounted, it will be one of these two unless you set it to something yourself

I like to set linux up with three partitions (plus any other partitions you need for Windows or OSX): /, the swap partition, and /home. The swap partition is always a separate partition in linux; making / and /home separate partitions allows you to update or reinstall without affecting your user's data - for example, to do a clean reinstall set the format flag for / and DON'T set the format flag for /home in the installer. That will format everything but /home before installing.

/home/user (where user is a user name like jlfenton or ptbarnum or iamaweiner) is where your user stuff goes. Anything starting with a period will be hidden unless you ask to see it specifically. Unlike Windows, which hides certain files and dirs ALWAYS with no way to view them, linux lets you view anything in you home, and in the root if you know the password. Config files for your user for programs will either be in /home/user or a directory in /home/user, like /home/user/.wine is the hidden directory where all your wine stuff for the user will go.

To start stuff at boot time, most distros have a settings program for that. In xubuntu, go to the Applications menu, go to Settings, and select XFCE Settings Manager. In the window that appears, you'll see a control labeled Session and Startup - click that to get to the session and startup control panel where you can set things like the splash screen, applications that run at startup, see currently running programs in your session, etc. In the Applications startup, there's a list of applications added by default that you can turn off and remove to use less memory, and an Add button to add your own programs to run at startup.

Your programs will either be in user home directory, or in /usr/bin or /usr/local/bin. When in your home, only you can use the program. When in /usr, any user can use it. You will need the root password to install to /usr. Anything installed to your home never needs a password since it's YOUR home and you are doing the installing.

Your custom program should probably make a hidden directory in the home for config files and working files. To avoid needing to specify the whole path (which you might not know), the "~" symbol is a shortcut for /home/user for the current user. For example, "~/.wine" would expand to "/home/jlfenton/.wine" on my session. Remember, hidden - put a period in front of the directory name you use, like "~/.myApp/stuff.cfg" for a config file.

There are a number of package installers depending on the distro and where it derived from. The best package installer for debian based distros is Synaptic and is in the Applications>System menu (as Synaptic Package Manager on ubuntu systems). SUSE uses YaST for its package manager. Different distros use different package managers because the people working on the distros have different opinions of what is best. That is the same for the underlying packages, which are normally either .deb or .rpm. Debian based distros use .deb packages and RedHat based distros use .rpm.

I currently use Xubuntu, which is Ubuntu with XFCE as the desktop manager. I find it preferable to Gnome or KDE as it is less resource intensive and faster. It allows you to run any Gnome/gtk software, and any KDE software if you install the KDE compatibility libraries. When you install a KDE program via Synaptic Package Manager, Synaptic will automatically select all the compatibility stuff for you if it's not already installed. Synaptic is VERY good at maintaining the required libraries and tools needed for running the programs you select to install.

Xubuntu is based on Ubuntu which is a debian based distro, so it uses .deb packages and comes with the Synaptic Package Manager. Use that to install whatever else you need like WINE and gcc and media playing programs like mplayer or vlc or xine, and anything else that strikes your fancy. I recommend getting the Xubuntu install CD instead of the DVD. That installs a minimum amount of stuff by default, then you can install anything else you want via Synaptic. That way you have a pretty lean and clean system. Installing through Synaptic from the Ubuntu repository is a good way to be sure you aren't installing anything with malware.

Booting in user mode instead of root is good for security, and it helps keep things organized. Like I mentioned, while you are logged in as a particular user, ALL your user settings and work files and stuff you download will all be found in /home/your_user so that it is separate from anyone else and separate from the root. The user cannot install to anywhere else but their home directory without giving the password, so anything asking for a password tips you off that it wants root level access, giving you a chance to deny it if it seems suspicious. Most of the time, you'll never notice the difference between running as a regular user, and running as root. Running as root means that you clutter the root of your drive, and anything you do will affect EVERYONE on the computer.

Even if you're the only one on the computer, and you are the only directory in /home, it's best to get in the habit of running as a user and not root so that you build good security habits. As I mentioned, you'll normally never notice the difference if you're not doing something like installing new software or changing a root level config, and even then you'll just be prompted for the password.

I always recommend people get a number of different distros to try - you might like one more than another. Also, backup anything on the drive you will use (assuming you have anything on it you wish to save) and then simply try those different distros for a few days with NO REGARD to saving anything. Bang the hell out of the distro doing anything and everything and see what happens, then do a clean install and try again. I think you'll find linux (any distro) is relatively hard to goof up, especially if you don't run as root. When you are comfortable and found a distro you like, do a clean install (set the installer to format all the partitions), and then install just the programs you want.

The #1 CLI in linux is BASH, so google "bash tutorial" and you'll find many good pages that cover using the linux terminal. All linux shells use mostly the same syntax, so with very few exceptions, a tutorial for bash should work on any shell in linux, bash or not. Having a basic understanding of the shell is good since there are things that are easier in a shell than in a GUI... like renaming all the files in a directory, or converting all the jpgs in a directory to bmps or pngs.

neologix
Very interested
Posts: 122
Joined: Mon May 07, 2007 5:19 pm
Location: New York, NY, USA
Contact:

Post by neologix » Thu Aug 11, 2011 3:15 pm

re bash command line - http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html is great to start, and http://tldp.org/LDP/abs/html/ is fantastic for advanced stuff.

re startup items in command line - on bash, you'll be editing two files in your home directory, .bash_profile and .bash_login (both as plain text and in bash scripting syntax), but these two files can theoretically include other files (ideally the same syntax) by calling the source command; i have a file .aliases where i put custom aliases, for example, and source that in my .bash_profile. you can also put stuff in the directory /etc/init.d/ as needed; google it for a better explanation of it than i can give at the moment.

KanedaFr
Administrateur
Posts: 1150
Joined: Tue Aug 29, 2006 10:56 am
Contact:

Post by KanedaFr » Fri Aug 12, 2011 10:36 am

Thanks for this (long) reply Chilly Willy!

I'm actually reading Linux Filesystem from tldp (thanks for the tips neologix)
Very interesting! The reason they worked on this standard is exactly the reason why I didn't move on Linux when I was still at school ;)

I already tried several small distros

- DSL => my best one for the moment, I REALLY love their different package system (from tgz, dsl in ram, unc/uci mounted)...very strange since my first thought was "oh no, another package system again!". Can't wait to test their "make your own distro" tool ;)

- Slitaz => love this one, you could make your own distro on 2 clicks!
it's also the one who make me wonder what's the diff between root and user, since it asks for root password everytime, meaning it does a LOT of stuff using root ...need to test it on my system and compare to DSL

- Puppy => need to retry it, my first try wasn't successfull

- tinyCore => VERY basic one...you need to install almost anything...

- ttylinux => not enought and doesn't come with fr keyboard (ARG!!!)

I plan to install it on a thin client (cost nothing!) so if you know a distro which could fit on it, let me know...

xubuntu is the ubuntu with the mouse logo ? if yes, it's the only one I like.
too bad it takes so long (like others ubundu distro) to boot.

can you confirm me uninstall of applications are to be done by hand ?
DSL, while 50M, comes with 3 browsers and I would like to keep dillo only

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Fri Aug 12, 2011 8:28 pm

Yeah, xubuntu has used a mouse logo on the splash screen for quite a while. You can remove programs via the command like or from Synaptic (package managers have always let you install, remove, or reinstall packages). One of the things I like about xubuntu is their install CD - most distros have gotten so big they come on multiple DVDs; xubuntu has a minimal CD installer or a DVD similar to the regular ubuntu. The CD doesn't install a lot (since it's just a CD), but you can still remove what is installed if you don't want/need it. For example, Abiword is installed as the default word processor on xubuntu, but you could always remove it if you don't need it.

As long as your computer isn't TOO old or low on memory that it requires DSL or Puppy, xubuntu is my favorite. Actually, they're working on an even smaller version of ubuntu called Lubuntu for systems too low even for xubuntu. If you haven't tried that one, you might take a look.

As to boot speed, the ubuntu family got faster starting with 10.10, which is what I'm running. My xubuntu install takes 15 seconds to reach the desktop from the moment grub starts linux. It takes longer for the PC's POST than it takes linux to boot. :)

I don't see what people had against boot time before in any case... it never took more than 70 seconds or so to boot linux (from hard drive, not CD... LiveCDs are always super slow booting). Why, my old Mac booting System 7 would take so long to boot, I'd turn on the Mac and go make breakfast and a pot of coffee while waiting for it to finish! :lol:

Post Reply