Unix Toolbox. Unix Toolbox. This document is a collection of Unix/Linux/BSD commands and tasks which are useful for IT work or for advanced users. This is a practical guide with concise explanations, however the reader is supposed to know what s/he is doing. Hardware | Statistics | Users | Limits | Runlevels | root password | Compile kernel | Repair grub | Misc. Running kernel and system information. Get the kernel version (and BSD version). Full release info of any LSB distribution.
- Though it doesn't mean that you can't burn DVD-Video discs with dvd+rw-tools. [Unlike Video-CD] DVD-Video is 'molded' in an ordinary data file system and therefore no explicit support by the burning program is actually required.
- This disc contains a 'UDF' file system and requires an operating system that supports.
- A collection of Unix/Linux/BSD commands and tasks which are useful for IT work or for advanced users.
Su. SE- release # Get Su. SE version. # cat /etc/debian_version # Get Debian version. Use /etc/DISTR- release with DISTR= lsb (Ubuntu), redhat, gentoo, mandrake, sun (Solaris), and so on. See also /etc/issue. Show how long the system has been running + load. Display the IP address of the host. Linux only). # man hier # Description of the file system hierarchy.
General Notes. This is an Unofficial Ubuntu 7.04 (Feisty Fawn) Starter Guide. It is neither associated with Ubuntu nor with Canonical Ltd. This guide can be discussed at the official UbuntuGuide.org Forum at ubuntuforums.org. Add new screen resolution in Linux Mint. Linux does not have as much options for display resolutions as in windows. A 22' Monitor in linux will have 1920x1080, 1440x900, 1280x960, 1024x768 resolutions. Some users may need.
1. What is an ISO image? An ISO is a file that contains the complete image of a disc, from sector 0 to the end. Such files are often used when transferring CD/DVD images over the Internet, and are commonly used as a.
Show system reboot history. Hardware Informations. Kernel detected hardware. Detected hardware and boot messages.
Read BIOSLinux# cat /proc/cpuinfo # CPU model. Hardware memory. # grep Mem. Total /proc/meminfo # Display the physical memory. Watch changeable interrupts continuously. Used and free memory (- m for MB). Configured devices.
Show PCI devices. Show USB devices. Show a list of all devices with their properties. Show DMI/SMBIOS: hw info from the BIOSFree. BSD# sysctl hw. model # CPU model. Gives a lot of hardware information.
CPUs installed. # sysctl vm # Memory usage. Hardware memory. # sysctl - a | grep mem # Kernel memory settings and info. Configured devices. Show PCI devices.
Show USB devices. Show ATA devices.
Show SCSI devices. Load, statistics and messages. The following commands are useful to find out what is going on on the system. I/O statistics (2 s intervals). BSD summary of system statistics (1 s intervals). BSD tcp connections (try also - ip).
BSD active network connections. BSD network traffic through active interfaces. BSD CPU and and disk throughput.
System V interprocess. Last 5. 00 kernel/syslog messages. System warnings messages see syslog. Users# id # Show the active user id with login and group. Show last logins on the system. Show who is logged on the system. Add group "admin" and user colin (Linux/Solaris).
Colin Barschel" - g admin - m colin. G < group> < user> # Add existing user to group (Debian). A < user> < group> # Add existing user to group (Su. SE). # userdel colin # Delete user colin (Linux/Solaris).
Free. BSD add user joe (interactive). Free. BSD delete user joe (interactive).
Use pw on Free. BSD. Add a new member to a group. Colin Barschel" - g admin - m - s /bin/tcsh. Encrypted passwords are stored in /etc/shadow for Linux and Solaris and /etc/master. Free. BSD. If the master. To temporarily prevent logins system wide (for all users but root) use nologin.
The message in nologin will be displayed (might not work with ssh pre- shared keys). Sorry no login now" > /etc/nologin # (Linux). Sorry no login now" > /var/run/nologin # (Free. BSD)Limits. Some application require higher limits on open files and sockets (like a proxy. The default limits are usually too low.
Linux. Per shell/script. The shell limits are governed by ulimit. The status is checked.
For example to change the open files limit from. This is only valid within the shell. The ulimit command can be used in a script to change the limits for the script only. Per user/process. Login users and applications can be configured in /etc/security/limits. For example. # cat /etc/security/limits. Limit user processes.
Limit application open files. System wide. Kernel limits are set with sysctl. Permanent limits are set in /etc/sysctl. View all system limits.
View max open files limit. Change max open files limit.
Permanent entry in sysctl. How many file descriptors are in use. Free. BSDPer shell/script. Use the command limits in csh or tcsh or as in Linux, use ulimit in an sh or bash shell. Per user/process.
The default limits on login are set in /etc/login. An unlimited value is still limited by the system maximal value. Kernel limits are also set with sysctl.
Permanent limits are set in /etc/sysctl. The syntax is the same as Linux but the keys are different. View all system limits. XXXX # maximum number of file descriptors. Permanent entry in /etc/sysctl.
Typical values for Squid. TCP queue. Better for apache/sendmail. How many file descriptors are in use. How many open sockets are in use. Default is 1. 02. See The Free. BSD handbook Chapter 1.
And also Free. BSD performance tuninghttp: //serverfault. Solaris. The following values in /etc/system will increase the maximum file descriptors per proc. Hard limit on file descriptors for a single proc.
Soft limit on file descriptors for a single proc. Runlevels. Linux. Once booted, the kernel starts init which then starts rc which starts all scripts belonging to a runlevel. The scripts are stored in /etc/init. N. d with N the runlevel number.
The default runlevel is configured in /etc/inittab. It is usually 3 or 5. The actual runlevel can be changed with init. For example to go from 3 to 5. Enters runlevel 5. Shutdown and halt. Single- User mode (also S)2 Multi- user without network.
Multi- user with network. Multi- user with X6 Reboot. Use chkconfig to configure the programs that will be started at boot in a runlevel. List all init scripts.
Report the status of sshd. Configure sshd for levels 3 and 5. Disable sshd for all runlevels. Debian and Debian based distributions like Ubuntu or Knoppix use the command update- rc. Default is to start in 2,3,4 and 5 and shutdown in 0,1 and 6.
Activate sshd with the default runlevels. With explicit arguments. Disable sshd for all runlevels. Shutdown and halt the system.
Free. BSD. The BSD boot approach is different from the Sys. V, there are no runlevels. The final boot state (single user, with or without X) is configured in /etc/ttys. All OS scripts are located in /etc/rc.
The activation of the service is configured in /etc/rc. The default behavior is configured in /etc/defaults/rc. The scripts responds at least to start|stop|status.
Go into single- user mode. Go back to multi- user mode. Shutdown and halt the system. Reboot. The process init can also be used to reach one of the following states level. For example # init 6 for reboot.
Halt and turn the power off (signal USR2)1 Go to single- user mode (signal TERM)6 Reboot the machine (signal INT)c Block further logins (signal TSTP)q Rescan the ttys(5) file (signal HUP)Windows. Start and stop a service with either the service name or "service description" (shown in the Services Control Panel) as follows. WSearch. net start WSearch # start search service. Windows Search". net start "Windows Search" # same as above using descr. Reset root password. Linux method 1. At the boot loader (lilo or grub), enter the following boot option. The kernel will mount the root partition and init will start the bourne shell.
Use the command passwd at the prompt to change the password and then reboot. Forget the single user mode as you need the password for that.
If, after booting, the root partition is mounted read only, remount it rw. Free. BSD method 1. On Free. BSD, boot in single user mode, remount / rw and use passwd. You can select the single user mode on the boot menu (option 4) which is displayed for 1.
The single user mode will give you a root shell on the / partition. Unixes and Free. BSD and Linux method 2. Other Unixes might not let you go away with the simple init trick. The solution is to mount the root partition from an other OS (like a rescue CD) and change the password on the disk. Boot a live CD or installation CD into a rescue mode which will give you a shell. Find the root partition with fdisk e.
Mount it and use chroot: # mount - o rw /dev/ad. Kernel modules. Linux# lsmod # List all modules loaded in the kernel.
To load a module (here isdn)Free. BSD# kldstat # List all modules loaded in the kernel. To load a module (here crypto)Compile Kernel. Linux# cd /usr/src/linux. Clean everything, including config files. Reuse the old . config if existent. Qt) or gconfig (GTK).
Create a compressed kernel image. Compile the modules. Install the modules. Install the kernel. Optionally update the source tree (in /usr/src) with csup (as of Free. BSD 6. 2 or later).
I use the following supfile. Free. BSD. org # www. CVSUP- MIRRORS. *default prefix=/usr. RELENG_7. To modify and rebuild the kernel, copy the generic configuration file to a new name and edit it as needed (you can also edit the file GENERIC directly). To restart the build after an interruption, add the option NO_CLEAN=YES to the make command to avoid cleaning the objects already build.
GENERIC MYKERNEL. KERNCONF=MYKERNEL. KERNCONF=MYKERNEL. To rebuild the full OS. Build the full OS but not the kernel.
Use KERNCONF as above if appropriate. Compares only files known to be essential. U # Update all configurations and other files.
For small changes in the source you can use NO_CLEAN=yes to avoid rebuilding the whole tree. NO_CLEAN=yes # Don't delete the old objects. KERNCONF=MYKERNEL NO_CLEAN=yes. So you broke grub? Boot from a live cd, [find your linux partition under /dev and use fdisk to find the linux partion] mount the linux partition, add /proc and /dev and use grub- install /dev/xyz. Suppose linux lies on /dev/sda. Misc. Disable OSX virtual memory (repeat with load to re- enable).
Faster system, but a little risky. System/Library/Launch. Daemons/com. apple. OSX). # defaults write - g com.
OSX mouse acceleration (use - 1 to reverse)Listing | Priority | Background/Foreground | Top | Kill. Listing and PIDs. Each process has a unique number, the PID.
A list of all running process is retrieved with ps. Extensive list of all running process. However more typical usage is with a pipe or with pgrep (for OS X install proctools from Mac. Ports). # ps axww | grep cron. Is 0: 0. 1. 4. 8 /usr/sbin/cron - s. All processes in a tree format (Linux).
Find all ssh pids without the grep pid.