|
Operating Systems & CommandsHere are my notes on the most popular computer systems and the commands to control them, shown side-by-side. Let me know what you find helpful or missing.
|
|
Sysinfo by Microsoft and MagniComp details system hardware, software, OS configuration, and storage asset management and configuration data in multiple platform agnostic formats. |
Operating System Kernels
This comparison of features across Unix implementations from Puppet, a cross-Unix administration tool. Windows applications, such as Crossover Office, can be run on Linux (with varying success) by using Wine, an open source implementation of the Windows API running on top of Linux OS's. In the early 1980s, Richard Stallman began the Open Source movement within the software industry by preaching that software should be free in that source code should be shipped with the software product because users: Windows Management Instrumentation (WMI) is based on the Common Information Model (CIM) supported by the Desktop Management Taskforce (DMTF) Making UNIX and Windows NT Talk by Nadelson, Mark.; Hagan, Tom (Lawrence, Kan. CMP Books, 2000) Windows 2000 & Unix Integration Guide by Burnett, Steven Forrest.; Gunter, David.; Gunter, Lola. (Berkeley, Calif. McGraw-Hill Professional, 2000) Linux can serve Windows clients via the Samba package. Installing Windows clobbers the dual-boot disk created when Linux is installed. Memconf by Tom Schmidt is a Perl5 script that displays the size of each SIMM/DIMM memory module installed in Sun/HP-UX systems. Listed in the SunManagers FAQ.
Poof! by Kilowatt Software provides 135 Windows command line tools.
use it instead of
SlickRun is a free floating command line utility for Windows so that command aliases (known as MagicWords) provide instant access to any program or website. |
Command Interpreter Shells -- Their Prompts and History
The C shell and Korn shell is preferred over the original Bourne shell which did not have command history capability. |
Shell Feature Comparison
| To be prepared to use various shells, define different temporary folder names. On UNIX systems, use these commands: $ mkdir /u01/oradata/tmp $ TMPDIR=/u01/oradata/tmp; export TMPDIR $ TEMP=/u01/oradata/tmp; export TEMP $ TMP=/u01/oradata/tmp; export TMP$80/62 Your Unix 'The Ultimate Guide' (McGraw-Hill, 2001) by Sumitabha Das of Calcutta features 900 exercises for the Bourne, Korn, bash, Linux and C shells Data files, Solutions manual The Complete Idiot's Guide to UNIX by Wagner, Bill (Indianapolis, Ind. Alpha Books, 1998) Checking UNIX Server Performance $3 UNIX Shell Programming, 2nd ed. (Hayden Books (Pearson): 1990) by Stephen G. Kochan and Patrick H. Wood Programming the UNIX Shell 3 week Online course I $295 & II $195 Sams Teach Yourself Shell Programming in 24 Hours by Veeraraghavan, Sriranga (Indianapolis, IN Sams Publishing, 1999) UNIX Shell Programming Tools by Medinets, David. (New York McGraw-Hill Professional, 1999) Learning the Bash Shell by Newham, Cameron.; Rosenblatt, Bill. (Cambridge, [England] O'Reilly and Associates, 1998) Unix Network Management Tools by Maxwell Unix System Security Tools by Ross UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things. -- Doug Gwyn sunfreeware.com offers several "ready to use" Software for SUN Solaris. |
Command Syntax
|
Keyboard Operations
| More on MS keyboard shortcuts In the UNIX Korn shell, this command prevents users from being logged off the system when Ctrl-D is pressed:
|
Command History
The UNIX BASH shell remembers the last several commands entered in the command line. The number of history events saved depends on the HISTSIZE environment variable. This command history can be viewed by the command prompt:
Retrieve specific commands several ways:
|
Cross-dressing Windows as UNIX
Products that run UNIX commands (GNU utilities) on the Windows operating system: Porting ksh and tcsh Shell Scripts to the Windows Services for UNIX 3.0 (SFU) Interix environment. |
Unix File PermissionsIf you create a UNIX shell script and run it, you will get a "Permission denied" message if you don't explicitly assign execute permissions with a command such as:
Each permission is stored as one binary bit within a 4-bit number. Unix commands specify all three permissions at once using the decimal equivalent of the 4 bit "octal" number, so called because one can count to 8 using 4 binary bits.
An octal number is used to store the permission of each category of ownership. Umask filename without argument echoes current permissions settings as an octal number. chmod 754 filename sets permissions using "7" for user, "5" for group, "4" for other. umask 023 filename (user mask) cause all new files to be created as if "chmod 754" were executed after their creation. chmod ugo+rwx filename sets permissions for all category of ownership.
chmod a+r filename sets permissions for all users. In Solaris, to modify the default group membership of a file:
| Auditing and Security : AS/400, NT, Unix, Networks, and Disaster Recovery Plans by Musaji, Yusufali F. (New York John Wiley & Sons, Inc. (US), 2001) |
CPU InformationTo get a list of the CPUs on a machine: On Solaris: /usr/sbin/psrinfo -v To list the RAM usage for a machine:
Related page: The Windows Management Interface. |
Machine Control Commands
|
Network Control
|
Processes/Services/DaemonsA process is a sequence of actions that take place in memory. It is referred to as active because it is the work the computer does in response to the execution of commands.
|
Forking ProcessesTo fork processes:
This example uses tee to send 1>stdout and 2>sterr separately and also both together so you can see when each occurred with respect to each other:
|
Disk Utilities
|
Folder Locations
To get a list of libraries mapped into processes on Solaris: pldd $$ |
Folder/Directory Commands and Options
|
File Listing Commands and Options
|
File Type IndicatorsThe "ls -l" command lists permissions for both files and directories. An example:
The test command also uses -s for nonzero size, -w for writeable by the current user, -a for ??? |
For no color
An inode number is the address of a disk block. Two filenames with the same inode means they are aliases of the same physical file. To create a hard file link (within the same directory):
To create a symbolic link:
|
File AttributesMicrosoft uses the first letter of each attribute name (read-only, archive, system, hidden):
/s specifies processing of all downstream subdirectories as well. To remove read-only and hidden attributes from myfile located in mypath:
| UNIX Filesystems : Evolution, Design, and Implementation by Steve D. Pate (Indianapolis, IN John Wiley & Sons, Inc. (US), 2003) |
File Manipulation Commands and OptionsTo obtain a file from the internet using HTML: wget http://drupal.org/files/projects/drupal-x.x.tar.gz Having a bunch of these in a batch file is how you automate downloads instead of right-clicking on a link and selecting "Save Target As...".
|
Redirection & Piping
|
File Utilities
WinBatch from Morrie Wilson WindoWare of Seattle compiles makes executable runtimes from macro scripts written using its own “Windows Interface Language” for controlling Windows and Windows NT and Novell Netware clients. MIcrosoft's Windows Scripting Host /rdb from Revolutionary Software is a commercial product ($249 for Linux/BSD $495 for Sun/AIX/HP/Windows) implemented as a suite of 131 UNIX shell level commands. It's described in UNIX relational database management: application development in the UNIX environment and the 1988 UNIX Relational Database Management, both by Rod Manis, Evan Schaffer, and Robert Jorgensen. |
Symbolic LinksUNIX OSs allow a "virtual" name that "redirects" references to that name to a physical file. To create a symbolic (pointer) link called "FileX" to "RealFile":
|
Pattern Matching
The MS-DOS CLI command Comp compares the contents of two files or two sets of files. Its syntax:
/d yields a decimal display. /a yields an alpha display. /l shows the line numbers for differences rather than offset. /n forces the line-by-line comparison for n lines, even in different length files. /c removes case sensitivity. Usage Example:
compares the files in \path1\myfiles with those in \path2\myfiles and show just the line numbers of any discrepancies. The MS-DOS CLI command FC (file compare) two individual files and displays content discrepancies. Its syntax:
/a yields an abbreviated display of discrepancies. /b specifies a binary compare (ASCII is the default for files not having a binary extension). /c means case-insensitive. /l is the ASCII compare for files having a binary extension (such as .exe). /lbx buffer size (the x part) for how many discrepancies Fc should tolerate before exiting. /n shows line numbers during ASCII compare. /t skips expanding tabs to spaces. /u performs unicode compare. /w skips consecutive whitespaces. The MS-DOS CLI command findstr (find string) in an individual file. Its syntax:
/b finds pattern at start of line. /e finds pattern at end of line. /l uses literal find pattern. /c:mystring is the string to search for. /r (default) searches for non-literal strings. /s also searches subdirectories. /i is insensitive for case. /x shows exact matching lines only. /v shows non-matching lines only. /n prints line numbers. /m shows matching files only. |
sed (stream editor)sed works like a find-and-replace filter. Its general format is: 's/ regexp / replacement / flags'This sample command from a FAQ) produces a newfile after replacing every occurrence of "Glenn" with the word "Harold":
F. Curtis Michel Introduction to sed says: "you will almost NEVER get the command line right the first time!" "regex" ("Glenn" in the example above) is a regular expression pattern. More examples: $d # delete the last line of the file /[0-9]\{3\}/p # print lines with 3 consecutive digits 5!s/ham/cheese/ # except on line 5, replace 'ham' with 'cheese' /xyz/!s/aaa/bb/ # unless 'xyz' is found, replace 'aaa' with 'bb' 17,/foo/d # delete all lines from line 17 up to 'foo' awkExample: to extract some part of the content of a line searched, and rename the previous output file to the text found: awk 'BEGIN{FS=":"}/^DnsName/{print $2}' outputfile > newfile
$63/$26 The AWK Programming Language (Addison-Wesley (Pearson): 1988) by Alfredo V. Aho, Brian W. Kernighan, and Peter J. Weinberger text2html.awk converts a text file to html. | sed was first written by Lee E. McMahon in 1974 as "A Non-interactive Text Editor". Because he made his source available, several improvements are now available. Eric Pement has an errata of sed versions in his sed faq:
GNU sed v4.0 - v4.0.5, GNU sed v3.02.80 GNU sed v3.02 GNU sed v2.05 GNU sed v1.18 GNU sed v1.03 sed v1.6 (Briscoe) sed v1.5 (Helman) sedmod v1.0 (Chen) HP-UX sed SunOS sed v4.1, v5.6 Ultrix sed v4.3 Digital Unix sed |
RandomizersKsh provides a variable to generate a random number between 0 and 32767:
SECONDS # The number of seconds since the shell was invoked |
Iteration in Shell ScriptsWith Windows Shell scripts set the default script host so you don't have to type cscript before each .vbs file execution:
A sample DOS script to invoke the "Ping of Death" to crash your machine: @echo off CLS REM Start Task Manager: start /high /min taskmgr.exe REM REM Launch Internet Explorer to a site: start /high http://www.microsoft.com/ REM REM Invoke the ping of death to crash your machine: for %%d in ( A B C D E F G H I J K L M N O P Q R ) do start /min ping -l 65527 -n 1000 localhost while ... do ... if who | wc -l > 1 ; then echo "There is 1 user"; else echo "There are x users" ; fi |
Related:
|
| Your first name: Your family name: Your location (city, country): Your Email address: |
Top of Page
Support this site: Thank you! |