Knoppix Linux newbie commands

This is a quick guide to the most-used commands in a Linux shell, intended for someone who has never used the shell (command line) in Linux before.

What is a shell?

The Linux shell is a CLI, or command line interface. A prompt (such as $ ) is shown and commands typed in. They are run when the enter key is pressed. The command executes, some text may be witten to the screen, the text scrolls up the screen, and a new line is displayed, with another prompt, ready for another command. The Linux shell is very advanced, most tasks can be accomplished using the shell, but this page focuses on the most basic tasks required.

Loading a shell

The simplest way to use a shell is to hold down the Ctrl and Alt keys, and press F1. Now login. To return to the grapical interface, repeat, but with a different key, probably F7, or in Knoppix F5.

If you’re using a GUI, you can open a shell in a window. In KDE, for instance, click the shell icon: Shell

Setting a password

To set the password for the knoppix user open a shell and type passwd.

To set the root (administrator) password, first type su then type passwd. This can be useful if you need to access your knoppix machine from another machine.

Alternativly, you can open a root shell in Knoppix, click the pengion icon and click Root Shell Root shell

Mounting a drive

To mount a hard drive, you can just click its icon on the desktop. This mounts it read only. Right click on its icon and choose 'Change read/write mode' to make it writable. Change read write mode Note that, at the moment, Linux cannot write to NTFS-formatted drives – if you use Windows NT, Windows 2000, Windows XP or Windows 2003 you probably have an NTFS-formatted drive. Knoppix will inform you of this, and will not let you write to your drive. Mounting CDs is done in the same way.

Mounting a USB drive

This should be as simple as plugging the USB drive in, waiting for an icon to appear on the desktop, and clicking it. If no icon appears on the desktop, try rebooting the computer into Knoppix with the drive plugged in. Some drives don't work well with Knoppix and cause it to crash, if Knoppix isn't booting and you have USB drives plugged in (including devices like cameras and MP3 players) try unplugging these and see if that corrects the problem.

Starting the Network

If your network was not started automatically when you loaded Knoppix, follow the steps given in Knoppix Recovery to start the network, using the NetCardConfig program. You can also type netcardconfig at the shell (command prompt), or select it from the pengiun menu.Network configuration

Wiping your hard drive

If you want to delete all the data from you hard drive, and intend to reinstall Windows, type this in a root shell:

root@ttyp0[knoppix]# fdisk -l /dev/hda

The computer should output some information, this lists the partitions (virtual drives) on the disc. If the computer runs Windows, you will probably see something like this:

knoppix@ttyp0[knoppix]$ su root@ttyp0[knoppix]# fdisk -l /dev/hda Disk /dev/hda: 40.0 GB, 40007761920 bytes 255 heads, 63 sectors/track, 4864 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/hda1 * 1 1195 39070080+ 7 HPFS/NTFS

If you just want to wipe the drive use dd if=/dev/zero of=/dev/hda1 bs=1M count=10M to write over the partition table. To erase this entire hard disc so that it is almost impossible to recover the data from it, type shred -fzv /dev/hda. Be careful doing this, you cannot recover the data!

If you want to wipe the drive and make new partitions, run cfdisk /dev/hda. This gives you a program you can use to make new partitions, you then have to initialise them, for instance I might make these partitions with cfdisk:

cfdisk 2.12 Disk Drive: /dev/hda Size: 40007761920 bytes, 40.0 GB Heads: 255 Sectors per Track: 63 Cylinders: 4864 Name Flags Part Type FS Type [Label] Size (MB) ------------------------------------------------------------------------------------------------------------ hda1 Boot Primary NTFS 4096.19 hda2 Primary Linux 2048.10 hda3 Primary Linux swap 509.97 hda5 Logical Linux 10240.48 hda6 Logical W95 FAT32 20480.95 Logical Free Space 2632.09

This means that /dev/hda1 is NTFS, /dev/hda2 and /dev/hda5 are Linux, /dev/hda5 is FAT32, and /dev/hda6 is free space: I can use this space later. I could install Windows on /dev/hda1, Linux on /dev/hda2, /dev/hda3 and /dev/hda5 and use /dev/hda6 for storing files readable and writable to both. To initialise these drives I use:

root@ttyp0[knoppix]# mkntfs -I /dev/hda1 root@ttyp0[knoppix]# mke2fs -j /dev/hda2 root@ttyp0[knoppix]# mkswap /dev/hda3 root@ttyp0[knoppix]# mkreiserfs /dev/hda5 root@ttyp0[knoppix]# mkdosfs -F 32 /dev/hda6

Writing a CD

You can burn a CD using the K3B program. K3B

Installing Knoppix

You can install Knoppix permanently to your disc with knoppix-installed. I do not recommend this however, instead I suggest you use Mandrake Linux as this is much more suited to day to day use.

You can also copy the Knoppix CD to your hard drive so that you can remove the CD once Knoppix has booted, enabling you to use you CD drive (if you only have one). This is not a simple task if you have an operating system installed on your computer already, briefly it requires you to make an 800MB partition (using Partition Magic if you do not want to lose data), format it to ext2fs (mke2fs /dev/hdaX), and at the boot prompt execute knoppix tohd=/dev/hdaX. You can then boot Knoppix, and at the prompt enter knoppix fromhd=/dev/hdaX. You can remove the CD once it starts detecting hardware.

Running programs

To run a program installed on the system, simply type its name: programname. If the program isn't installed in one of the standard locations you need to give a path, like ./programname (if the program is in the current directory) or ./myprogram/program or /home/matt/bin/programname.

Further Questions

I made this page after looking at what people had searched for when they got to this page. I shall continue to check what people are searching for and add anything appropriate, but if you'd like to contact me with any suggestions, they might make their way on here sometime!