A brilliant, all-in-one Mac OS X web editor. Everything you need to write beautiful web code. ![]()
![]() 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. 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. 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. Install the Azure CLI 2. Install the new version of the Azure CLI today! We've improved and updated it to provide a great native command- line experience for managing Azure resources. It can be used on mac. OS, Linux, and Windows. For information about the latest release, see the release notes. Install on mac. OSOn mac. OS, you are able to install either with Homebrew or manually. Install with Homebrew. If you don't have it already, install Homebrew by following the Homebrew installation instructions. If you have previously installed the CLI manually, follow the manual uninstall instructions. Update your local Homebrew repositories. Install the azure- cli package. Note. If you previously installed the Azure CLI 1. Homebrew, instead of installing. CLI 2. 0 through the regular Homebrew upgrade process. Install manually. Install Azure CLI 2. L https: //aka. ms/Install. Azure. Cli | bash. You may have to restart your shell for some changes to take effect. SHELL. Run the CLI from the command prompt with the az command. Install on Windows. Install with MSI for the Windows command- line. To install the CLI on Windows and use it in the Windows command- line, download and run the Azure CLI Installer (MSI). Install with apt- get for Bash on Ubuntu on Windows. If you don't have Bash on Windows, install it. Open the Bash shell. Modify your sources list. Run the following sudo commands: sudo apt- key adv - -keyserver packages. A0. 89. 3. sudo apt- get install apt- transport- https. Run the CLI from the command prompt with the az command. Install on Debian/Ubuntu with apt- get. For Debian/Ubuntu based systems, you can install Azure CLI 2. Modify your sources list: 3. Run the following sudo commands: sudo apt- key adv - -keyserver packages. A0. 89. 3. sudo apt- get install apt- transport- https. Run the CLI from the command prompt with the az command. Install on RHEL, Fedora, and Cent. OS with yum. For any distribution which is based off of Red. Hat and contains the yum package manager, you can install Azure CLI 2. Import the Microsoft repository key: sudo rpm - -import https: //packages. Create local azure- cli repository information: sudo sh - c 'echo - e "[azure- cli]\nname=Azure CLI\nbaseurl=https: //packages. Update the yum package index and install: yum check- update. Run the CLI from the command prompt with the az command. Install on open. SUSE and SLE with zypper. Import the Microsoft repository key: sudo rpm - -import https: //packages. Create local azure- cli repository information: sudo sh - c 'echo - e "[azure- cli]\nname=Azure CLI\nbaseurl=https: //packages. Update the zypper package index and install: sudo zypper refresh. Run the CLI from the command prompt with the az command. Install with Docker. We maintain a Docker image preconfigured with the Azure CLI 2. Install the CLI using docker run. See our Docker tags for available versions. The CLI is installed on the image as the az command in /usr/local/bin. Note. If you want to pick up the SSH keys from your user environment. HOME}: /root to mount $HOME as /root. HOME}: /root azuresdk/azure- cli- python: < version>. Install on Linux without apt- get. It is recommended that you install the CLI with a package manager if you are able to. For distributions which do not have a package provided for them, you can manually install. Install the prerequisites based on your Linux distribution. Platform | Prerequisites. Ubuntu 1. 5. 1. 0 or 1. Ubuntu 1. 2. 0. 4 or 1. Debian 8 | sudo apt- get update & & sudo apt- get install - y python libssl- dev libffi- dev python- dev build- essential. Debian 7 | sudo apt- get update & & sudo apt- get install - y python libssl- dev libffi- dev python- dev. Cent. OS 7. 1 or 7. Red. Hat 7. 2 | sudo yum check- update; sudo yum install - y gcc python libffi- devel python- devel openssl- devel. SUSE Open. SUSE 1. If your distribution is not listed above, you will need to install Python, libffi, and Open. SSL. Install the CLI with curl. L https: //aka. ms/Install. Azure. Cli | bash. You may have to restart your shell for some changes to take effect. SHELL. Run the CLI from the command prompt with the az command. Troubleshooting. If you encounter an issue during CLI install, check this section to see if your particular case is covered. If your issue is not here, please file a Github issue. Object Moved" error. If you get an error from curl related to the - L parameter, or an error message including the text "Object Moved", try using the full URL instead of the aka. You may need to clear your shell's command hash cache. Runhash - r. and see if the problem is resolved. Uninstall CLI 1. x versions. If you have an earlier CLI 1. Uninstall with npm. Remove the older CLI with npm uninstall. Uninstall with distributable. If you installed via the Azure CLI Installer (MSI) or a mac. OS package, use the same tool to remove your install. Uninstall with Docker. If you installed a Docker image to use the earlier CLI version, remove that image and any associated containers. You can then re- create the containers. Docker image as described in the install instructions. Update the CLITo update the Azure CLI, use the same method that you used to install it. Update with Homebrew. If you previously installed manually, follow the install with Homebrew instructions. Update your local Homebrew repository information. Upgrade your installed packages. Update with MSIRun the Azure CLI Installer (MSI) again. Update with apt- get. Use apt- get upgrade to update the CLI package. Note. This will upgrade all of the installed packages on your system which have not had a dependency change. To upgrade only the CLI, use apt- get install. Update with Docker. Update your local image with docker pull. Get the containers currently using the CLI image. CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES. Exited (0) 8 minutes ago inspiring_benz. Note. If you installed a specific version of the image, you will need to add : < version> to the end of the image name. Halt and recreate the containers. Update manually. Follow the manual installation instructions for mac. OS or Linux to update. Uninstall. If you decide to uninstall the CLI, we're sorry to see you go. You should uninstall using the same method that you used to install the CLI. Uninstall with Homebrew. Uninstall the azure- cli package. Uninstall with MSIRun the MSI again and choose uninstall. Uninstall with apt- get. Uninstall via apt- get remove: sudo apt- get remove - y azure- cli. Uninstall with Docker. If you installed a docker image, you will need to remove any containers running it, and then delete the local image. Get the containers which are running the azure- cli image. CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES. Exited (0) 8 minutes ago inspiring_benz. Delete any containers with the CLI image. Remove the locally installed CLI image. Note. If you installed a specific version of the image, you will need to add : < version> to the end of the image name. Uninstall manually. If you used the script at https: //aka. Install. Azure. Cli to install the CLI, you can uninstall it with these steps. Remove the installed files. Delete the line < install location> /lib/azure- cli/az. Note. The default install location is /Users/< username>. Report CLI issues and feedback. If you encounter any bugs with the tool. Issues section of our Git. Hub repository. To provide feedback from the command line, use the az feedback command.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
November 2017
Categories |