Ok, I am not a Linux expert by no means. But I did have a lot of
questions when I started with Linux (coming from Windows). This page is an attempt to collect the most
frequently asked questions to myself by myself, as a Linux newbie. Maybe this
will be helpful to someone else. Or, it may help me if I loose my memory...
Oh, by the way... the initial distro was Mandrake, these days I do Debian.
Disclaimer: Use this info on your own risk. I take no responsibility if your system screws up. The tips here worked for me, they may not work for you. Check the man-pages, HOWTOs, and other resources. Be a responsible root.
The questionsThe shell
- Isn't there anything better than the shell?
- What are some useful commands?
- How do I move or rename a file?
- How do I delete a directory?
- How do I change a symbolic link to a file?
- How do I find a file?
- This command takes forever. How do I abort?
- I'm tired of typing the same commands over and over. Can I speed it up?
- How do I extract .gz and .bz2 files?
- Isn't it hard to compile the kernel?
- Why do I need to compile the kernel?
- What do I need in order to compile the kernel?
- How do I configure the kernel?
- How do I compile the kernel?
- Is the kernel installed after compilation?
- How do I know what kernel version I'm running?
- When I do make xconfig I get "Xlib: connection to :0.0 refused by server". What's wrong?
- cp : copy files
- rm : remove files. Be careful, once it's gone, it's gone...
- mv : move or rename files
- mkdir : create directory
- ls -al : list all files
- cat : show the content of a file
- less : show the content of a file, allows scrolling
- grep : find information in a file
- find : find files
- chmod : change the file permissions
- chown : change file ownership
- du : show disc file usage
- df : show file system usage
- pwd : show current working directory
- uname -r : show current kernel version
- su : become root
- exit : stop being root, or stop current shell
mv filename /to/wherever/This can also be used to rename a file, simply type...
mv filename new_filename
rm -fr directory
ln -fs original_name link_name
find /starting_directory -name 'filena*'To search everywhere, specify /, you may want to be root...
- up and down arrows: allows you to step through the history of the commands you have entered
- tab: try typing cd and the first letter or letters of some directory, then press tab...
- ctrl+r: allows you to do "reverse" lookup of your commands. Very handy...
tar xvzf file_name.tar.gzfor .tar.gz, and...
tar xvjf file_name.tar.bz2for .tar.bz2
Some people claim that vi can be a very powerful editor. Frankly, I have never had the desire, energy, or time to learn anything but the bare essentials of vi... For more "advanced" editing, I use a GUI editor. By the way, vim sucks a little bit less than pure vi...
The file system
Note: The information comes mostly from the Mandrake Reference Guide, and the "graphic" is shamelessly inspired by Garrik's Little Mandrake FAQ.
/--, :the root directory, the start of it all... |-/bin :essential binary files, necessary for system operation |-/boot :stuff for your bootloader, the kernel can be here |-/dev :system device files |-/etc :system configuration files | |-/rc.d :system init scripts | '-/sysconfig :various configuration files | |-/lib :libraries essential to the system | '-modules :kernel modules | |-/home :personal directories for the user(s) |-/mnt :mounting points for devices (CD-rom, Windows, etc.) |-/proc :kernel parameters, good for hardware info | '- /sys :allows you to change some kernel parameters | |-/root :the directory for root |-/sbin :system binaries essential for start-up |-/tmp :temporary files |-/usr :main application-storage, not needed for start-up | |-/bin :majority of system binaries | |-/lib :libraries for /usr/bin and /usr/sbin | |-/local :non-mdk installed applications | | | |-/include :headers needed for compilation | |-/sbin :system applications | |-/share :architecture-independent data | | |-/doc :documentation for a lot of stuff | | '-/man :pages for man... | |-/src :source-files, including kernel sources | '-/X11R6 :stuff needed to run the X Window System | '-/var :various data files used by some programs '-/log :log files, including dmesg and syslog
Compiling the kernel
Anyway, I see two reasons why you need to compile your own kernel:
- Because you can.
- You need to add some functionality to the kernel in order to make your computer run the way you want to.
- The kernel source. Can be found on the installation CD, or the net.
Once the source is installed, you'll find it in /usr/src/linux/
- A good set of instructions
- Time. You should give yourself 2+ hours for the process. It all depends on your level of experience, speed of your hardware, if you need to be at the bar at a certain time, etc.
make mrproper...will clean up any left-overs from that compilation. Then...
make xconfig...will start the configuration program. Specify the settings you need. The defaults may be good enough. Be careful, read the help for each setting. Save. This will create a file called .config containing all the settings.
It may be a good idea to customize the name of the kernel by changing the EXTRAVERSION line at the beginning of the Makefile file.
Note: if you're compiling a kernel with the exact same version as one of the kernels already existing on your system, you really should remove the modules for that (existing) kernel version. The modules are located under the kernel version in /lib/modules/. Life will be easier if you have booted to another kernel version...
make depNote: For a 2.4.x kernel make dep is required. For a 2.6.x kernel it is not used.
make clean bzImage modules
make modules_install install
Debian is doing things differently...
make-kpkg --initrd --revision=something-0.1 kernel_image modules_image
dpkg -i /usr/src/kernel-image-some_version_something-0.1_i386.deb
- In /boot/ make sure that the following symbolic links exists:
initrd.img -> initrd-your_kernel_version.img
System.map -> System.map-your_kernel_version
vmlinuz -> vmlinuz-your_kernel_version
- The installation adds a new entry in /etc/lilo.conf (if LILO is your boot-loader of choice). The entry is for the new kernel. Since the symbolic links points to the new kernel, change the new LILO entry to reflect the previous kernel instead.
- Don't forget to run LILO (lilo) after lilo.conf is changed. I have forgotten that numerous times...
- Reboot and enjoy. Should any problems emerge, reboot to the older kernel and fix the problems. In the worst case, reboot to a Knoppix CD.