|
Linux Documentation Project > How To Documents
Linux
TCO calculator
Unofficial Mandrake Wiki |
|
|
| Account
Management |
|
|
- Adding Accounts
$ useradd janet3
$ passwd janet3
{you are prompted to type the password for that user}
- Adding Groups
$ groupadd sales
$ groupmod -G groupuser
$ groupmod -G sales janet3
|
|
- # adduser foo -p supersecretpassword
|
|
|
|
|
|
|
| Apache |
|
|
- Apache start command
- Apache stop command
- Autostarting Apache
- chmod permissions
- Default location of htdocs
|
|
|
|
|
|
| Asterisk |
|
|
|
|
|
- While we're logged in, we should change the root password. To do this,
type "passwd" and enter the new password twice:
[root@asterisk1 root]# passwd
Changing password for user root.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@asterisk1 root]#
- Now that the password has been changed and we know the IP address of the
Asterisk machine, log out by typing "logout".
|
|
|
|
|
|
|
Autostart and Runlevels |
|
|
- Runlevel 3 = Text Shell
Runlevel 5 = Graphical User Intefrace
- #chkconfig --level 2345 sshd on
#chkconfig --level 016 sshd off
[You need both stops to define which run levels the service will run on, and define which
runlevels it will not run on. "Off" means kill, and "on" means start.
|
|
|
|
|
|
Background Picture |
|
|
- Start > System > Configuration > Configure Your
Desktop
LookNFeel > Background
- Default "Backgrounds" image directory
/usr/share/mdk/backgrounds/
|
|
|
|
|
|
|
|
|
Boot Loader Selection |
|
|
- Start > System > Configuration > Configure Your
Computer
Boot > Boot Loader > Lilo w/text
|
|
|
|
|
|
|
|
|
Clam |
|
|
- Homepage
- Webmin Module
- # useradd clamav
# groupadd clamav
# cd clamav-0.86.1/
# ./configure --prefix=/usr
# make install
# chown -R clamav /usr/share/clamav
|
|
- $ mkdir /var/lib/clamav
$ chown -R clamav:clamav /var/lib/clamav
$ touch /var/log/freshclam.log
$ chown clamav:clamav /var/log/freshclam
- $ freshclam -d
$ clamd
- Need to edit /usr/etc/clamd.conf
and
/usr/etc/freshclam.conf
- $clamscan -ri --move=/tmp/virus \/home/yourusername
|
|
|
|
Copying Files |
|
|
- $ cp <options>
<file1> <file2>
or
$ cp <options> <file(s)> <directory>
- $ cp /etc/cups/cupsd.conf <space>
/etc/cups/cupsd.conf.backup
- The -v option
This options stands for verbose, which will display the file name(s) on the screen as they
are copied.
|
|
- The -r option
Copy files recursively, all of the matching files from all subdirectories will also be
copied. For example, the command
"$cp -r */backup" will copy all all files in the current subdirectory to the
/backup directory.
|
|
|
|
|
|
|
CUPS: Printing |
|
|
|
|
|
- 5 - Give a functional name (need not be exact)
- 6 - Select Manufacturer
- 7 - Locate first recommended driver in the CUPS Web
Utility dropdown menu
- 8 - Select printer model
- 9 - Choose printer connection (i.e. USB)
- 10 - Print a test page
|
|
|
|
|
|
|
|
|
|
Filesystem Corrupted Needs Repairing |
|
|
- # fsck
- What if Linux refuses to boot after power failure?
Tutorial
- While rebooting, Linux may print a message saying that there is a problem
with the filesystem and it might force a check.
- While rebooting, Linux may
not be successful in any of the filesystem checks. In this case the booting stops abruptly
with a message stating that you should run fsck manually without a few
parameters. Once you reach the bash prompt (#) then run the fsck command as mentioned
(fsck -a -p /dev/hdaX). The fsck command requires the partition which it has to check.
So if you have installed linux on /dev/hda1 then you have to run fsck as follows : fsck -a
-p /dev/hda1
|
|
- When you run fsck it would
mostly find some inode problems and ask you whether you want to fix them, Select
the default option (yes). It would do so for all the problems found. Once this is
over you can restart the machine using either "Ctlr+Alt+Del" or "shutdown
-r 0", whichever works. Now this time your Linux machine should boot properly.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Hosts File |
|
|
- /etc/hosts
- 127.0.0.1 sex.com
|
|
- Restart TCPD
# /usr/sbin/tcpd restart
- bored.com
- myspace.com
|
|
|
|
Host Name: Command Line (Name of computer) |
|
|
- Identify the current hostname:
$ hostname
- Or edit two files:
/etc/sysconfig/network and the /etc/hosts
- In the /etc/sysconfig/network add the line:
HOSTNAME=jupiter
- Next in the /etc/hosts file change the "127.0.0.1
localhost.localdomain localhost" to:
127.0.0.1 jupiter localhost
|
|
|
|
|
|
Host Name: KDE (Name of computer) |
|
|
- Menu > Tools > System Tools > Configure Your Computer
- Authenticate as "root" user
- Network and Internet > Hosts Definitions
|
|
|
|
|
|
Host Name: Webmin (Name of computer) |
|
|
- Edit through Webmin like this:
Webmin > Networking > Network Configuration > Host Name & DNS Client
Edit the "Hostname" field
- Link in localhost for Webmin module:
https://127.0.0.1:10000/net/list_dns.cgi
|
|
|
|
|
|
|
|
|
Installing from Source |
|
|
- # cd /usr/src/downloads
- # tar zxvf joe-2.9.8.tar.gz
- # cd joe-2.9.8
- # ls
- # less README
- # less INFO
- # ./configure -- help
- # ./configure <options, if needed>
- # make
- #make install | tee joe - makeinstall
|
|
- # cd /usr/src/downloads
- # tar zxvf joe-2.9.8.tar.gz
- # cd joe-2.9.8
- # ./configure
- # make
- # su -C "make install"
Now you can just type joe and be on your way
|
|
|
|
Installing from URPMI |
|
Mandriva Club |
- URPMI Database Configuration
Login as root
Prevent URPMI database from request Mandrake Installation CDs
urpmi.removemedia –a
Launch KDE Graphical Desktop Environment
Startx
- Select Step 1:
Launch Konqueror
Visit club.mandrivacom
User: sc0tt@b0land3rh0m3.c0m
Pass: missyone
- Select Step 2:
Select downloads
- Select Step 3:
Select Mirror Finder
- Select Step 4:
Choose your PC's architecture
- Select Step 5:
Choose the Proxad mirror URPMI setup (if available)
|
|
Select Step 6:
Copy the URPMI media configuration command
Select Step 7::
Launch terminal window
Login as root
User: root
Pass: xxx
Paste the URPMI media configuration copied from the Mandrake Club
Select Step 7:
Wait while the PC updates from the URPMI mirror
urpmi –autoselect
urpmi update -a
|
|
|
|
Installing from URPMI (Easy URPMI) |
|
|
|
|
|
|
|
|
|
Installing Yum |
|
Using Yum |
- # rpm -ivh yum-2.0.4-1.noarch.rpm
|
|
|
|
|
|
IP Addresses |
|
|
- What is my current IP?
# ifconfig
- Configuring a Static IP
# /sbin/ifconfig eth0 192.168.1.100 netmask 255.255.255.0
|
|
|
|
|
|
|
|
|
Kill User Who Is Logged In |
|
|
- Identify logged-in users
$ who
- To logout user called raj, enter
$ pkill -KILL -u raj
|
|
|
|
|
|
|
|
|
Knoppix Installation |
|
|
- Boot to Knoppix
- Pull up command line
- $sudo knoppix-installer
- Hit <enter> when "Under Heavy
Development" warning comes up
|
|
|
|
|
|
Knoppix Configuration > USB Stick |
|
Creating
a Persistent, Encrypted Knoppix Home Directory |
|
|
|
|
|
|
|
Last |
|
|
- The most common command to do this is “last” which will list the last
users who logged into the system. Here are some examples:
- [root@rahtid log]# last -100
- root pts/0 reggae.simiya.co Thu Jun 19 09:26 still logged in
- root pts/0 reggae.simiya.co Wed Jun 18 01:07 - 09:26 (1+08:18)
|
|
|
|
|
|
|
|
|
|
|
|
Mandrake Post-Config |
|
|
- Setup URPMI mirrors & updates
- Install packages
ProFTPD
SpamAssassin
stunnel
Webmin
- Autostart
Webmin
|
|
|
|
|
|
|
|
|
MD5 Checksums |
|
|
- Message Digest algorithm 5 produces 128-bit output from input of any
length
- An MD5sum is a checksum created from a large stream of data using the MD5
algorithm and is often used to verify that large files downloaded correctly. Practically
speaking, an MD5sum-generating program takes your file and creates a fingerprint that only
one file is capable of making.
|
|
|
|
|
|
Mount |
|
Unmount |
- This command will show all of the mounted devices and/or allow you to
mount new devices.
- This command is available only to the root user.
|
|
|
|
|
|
Mount
USB Drive |
|
Unmount
USB Drive |
- Locate the drive:
# fdisk -l
- Make the drive:
# mkdir /mnt/pendrive
- Mount the drive:
# mount /dev/<device> /mnt/pendrive
|
|
|
|
|
|
Move |
|
|
- $mv allows you to move and rename files and directories
|
|
|
|
|
|
Network Configuration Settings |
|
|
- Known to work on CentOS
- cat /etc/sysconfig/network
vi /etc/sysconfig/network
DEVICE=eth0
NETMASK=255.255.254.0
ONBOOT=yes
TYPE=ethernet
NETWORKING=yes
HOSTNAME=localhost.localdomain
:wq
service network restart
|
|
- Ensim network configuration settings
- cat /etc/sysconfig/network
vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=ensim.securelevel.com
FORWARD_IPV4=yes
GATEWAYDEV=
GATEWAY=192.168.1.1
- :wq
service network restart
|
|
|
|
Network Restart |
|
|
- $ service network restart
|
|
|
|
|
|
Partitioning |
|
|
- qtparted is a graphical partitioning application
- cfdisk is a command line partitioning application
|
|
|
|
|
|
Permissions |
|
|
- Check permissions
$ ls -l
|
|
|
|
|
|
|
|
|
Puppy |
|
|
- Configure Ethernet
- Keyboard Mapping
- LinNeighborhood
|
|
- Sylpheed Email Client
- USB Drive Mounting
|
|
|
|
Redwall |
|
|
- # service webmin start
# vi etc/squid/squid.conf
|
|
|
|
|
|
Samba |
|
|
- Which version am I running?
# smbd -VT
- Config file location
/etc/samba/smb.conf
- Backup the
/etc/samba/smb.conf file
$ sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.original
- Create a user (as above)
Then create Samba password as follows:
# smbpasswd a- janet3
{You are prompted for a password}
- File and Directory Permissions
edit /etc/samba/smb.conf file, and add the following entries
read list = @planning
write list = @authors, richard
admin users = melissa
- Restart Samba
# /etc/rc.d/init.d/smb restart
|
|
- To access a shared folder resource known as documents offered by a remote
Windows computer named bill using smbclient for example, one would enter a command similar
to the following at the prompt
$ smbclient //bill/documents -U <username>
- Local mounting of remote network resources using the SMB protocol is also
possible using the mount command. For example, to mount a shared folder named
project-code on a Windows server named development
as the user dlightman to your Ubuntu system's /mnt/pcode
mount-point, you would issue this command at the prompt
$ mount -t smbfs -o username=dlightman //development/project-code /mnt/pcode
- To disconnect the shared resource, simply use the umount
command as you would with any other mounted file system.
$ umount /mnt/pcode
|
|
|
|
|
|
|
SCP |
|
|
- This
little tool lets you copy a number of files from one computer to another in a secure
encrypted form
|
|
|
|
|
|
Screen Savers |
|
|
- Start > System > Configuration > Configure Your
Desktop
LookNFeel > Screen Saver
- Default "Screen Savers" image directory
/usr/share/mdk/screensaver/
- Website full of screensavers:
http://www.kdelook.org/
|
|
|
|
|
|
Screenshots |
|
|
- import -window root screenshot.png
Of course screenshot.png is the filename you want to assign to your screenshot. It’s
quick and easy, and can be triggered at any time. You can even put it into a script, or
run a cron job that will take a snapshot of your current workspace at certain time
interval. The command above takes a snapshot
of the whole desktop.
|
|
- If you want to just grab a rectangular region, skip the
window parameter:
import screenshot.png
You cursor should change into a cross, and allow you to draw a rectangle over the desired
area and save it as the file name you specify.
Note that you will need to have the imagemagick package installed. On ubuntu do:
aptitude install imagemagick
|
|
|
|
Scripting |
|
|
|
|
|
- Save the file as filename.sh, such as wget.sh
- File permissions need to be set to allow the script to
execute
In KDE, select the file, right-mouse click, choose "properties" move to the
"Permissions" tab, and place a checkmark in the box labeled "Is
Executable". Then hit okay
- I like to store them in /home/username/scripts
...so if the "scripts" directory does not already exist, then create it with
mkdir /home/username/scripts
|
|
|
|
Searches in Linux |
|
|
- Find
- Grep
- Is Something Installed?
- Locate
|
|
- Searching in Linux
- View Files
- Whereis
|
|
|
|
Services: KDE |
|
|
- Menu > Tools > System Tools > Configure Your Computer
- Authenticate as "root" user
- Network and Internet > Manage System Services by Enabling or Disabling
Them
- Get info about a service
- Set a service to startup on boot
- Start a service
- Stop a service
|
|
|
|
|
|
|
|
|
Splash Screens |
|
|
- Start > System > Configuration > Configure Your
Desktop
LookNFeel > Splash Screens
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Update OS > URPMI way |
|
|
- su
<password>
MandrakeUpdate
|
|
|
|
|
|
URPMI |
|
|
- How to remove Installation CDs from media list
$ urpmi.removemedia Installation Free CD
- http://easyurpmi.zarb.org/
- How to update Mandriva
urpmi.update -a
urpmi --auto-select
|
|
- How to unlock a URPMI database
# rm -f "/var/lib/urpmi/.LOCK"
# rm -f "/var/lib/urpmi/.RPMLOCK"
|
|
|
|
Version of Operating System |
|
|
- Need to be root
- # uname -a
|
|
|
|
|
|
Version of Software |
|
|
- Need to be root
Type application name then -V
- This will report the version
- It cannot work if the application is not installed
- # smbd -V
|
|
|
|
|
|
vi |
|
|
- Open a file
# vi etc/squid/squid.conf
- Search
/ http_access
- Enter edit mode
Press the INSERT key
|
|
- Stop the edit mode
Press the INSERT key again
Press ctrl-j
- Save settings
shift Z Z
- Save changes and quit vi. :wq
- Save file to new file. :w file
- Quit without saving. :q!
|
|
|
|
VMware |
|
|
- VMware is a service, so can set to be available on boot (see Services:
KDE)
- Configure VMware Player from the command line:
$ /usr/bin/vmware-config.pl
- Answer question "In which directory do you want to install the theme
icons?"
(default answer is "/usr/share/icons"
Hit enter to accept the suggestion
- Answer question "What directory contains your desktop menu entry
files? These files have a .desktop file extension"
(default answer is "/usr/share/applications")
Hit enter to accept the suggestion
- Answer question "In which directory do you want to install the
applications icon?"
(default answer is "/usr/share/pixmaps/")
Hit enter to accept the suggestion
- Then the operating system will try to find a suitable vmon module for the
kernel you are running
- File location
/etc/vmware/
-
|
|
|
|
|
|
| VNC |
|
|
- Tight
VNC Home Page
- Router:
22>105 5900>105 5901>105
- VNC in Web Browser
5801 > 105
http://192.168.1.105:5801
|
|
- Start the VNC Service
$vncserver
- Launch VNC Client
$vncviewer 192.168.1.105:1
- Shutdown VNC Server
$vncserver -kill :1
- 192.168.xxx.xxx:1 is reaching
port 5901 on 192.168.xxx.xxx
|
|
|
|
VPN Configuration: KDE |
|
|
- Menu > Tools > System Tools > Configure Your Computer
- Authenticate as "root" user
- Network and Internet > Configure VPN Connection to Securet Network
Access
- Choose the VPN Type: Open VPN (or Cisco)
Next (KDE installs necessary packages)
-
-
|
|
|
|
|
|
| Webmin |
|
|
|
|
|
- Restart Webmin
# /sbin/service webmin stop
# /sbin/service webmin start
|
|
|
|
|
|
|
| What
Processes Are Running? |
|
|
|
|
|
|
|
|
|
| Who |
|
|
- This command is used to see who is currently logged in.
Here we see a user logged as root from server reggae.simiya.com .
- [root@rahtid log]# who
- root pts/0 Jun 19 09:26 (reggae.simiya.com)
- [root@rahtid log]#
|
|
|
|
|
|
| Wine |
|
|
- /etc/wine
- $ /home/user/mnt/win/
- Change to the directory where the windows application is located on your
system:
$cd "mnt/win/Program Files/Accessories"
$wine ./mspaint.exe
- Windows Directory
/usr/share/wine-c
- Run MS Paint
# wine /bin/mspaint.exe
- Copy DLL files into
/usr/share/wine-c/windows/system
|
|
- WineHQ
- Download Wine
- Is Wine faster than
Windows?
- Wine Tools
WineTools is a menu driven installer for installing Windows programs. This software lets
you install the following Windows software: DCOM98, IE6, Windows Core Fonts, Windows
System Software, Office & Office Viewer, Adobe Photoshop 7, Illustrator 9 and many
other programs.
|
|