UNIX notes:

Windows
Commands
:

Musings

Home

More Unix


By: Nicholas Duchon

Useful stuff:


Critical UNIX Commands

For more, see the UMUC Programming Guide.
You can find introductions to Linux/Unix commands by searching on the web.
Also, use Unix man pages, as in, or google "man pwd":
I thought perhaps a short list of critical Unix commands might be helpful for some:
Command
(> represents the prompt,
do not type this character)
Generally spaces count on command lines
Effect
> pwd print the work (current) directory
> ls
> ls -l
> ls -F
list the contents the current directory
ell, not one, long (detailed) list of files in this directory
put a / after directories and a * after executable files
> cd <directory name>
> cd www/p1

> cd ..
> cd $HOME
> cd

change directory to <directory name>, do not type <>'s in actual command
Example
dot dot represents the parent directory
go to your login (home) directory
> mkdir <directory name>
> mkdir p6
> mkdir $(cat "rollRow.txt")

make a subdirectory of the current directory

read the directories to make from a text file
> pico [<file name>]
> nano [<file name>]
a simple editors on most Unix systems
file names are optional, and as with directory names above, don't type the <>'s
> gcc -o prog.exe program.c
> g++ prog.cpp
compile and link a C program to an executable file called prog.exe, default would be a.out
compile and link a C++ program to a.out, by default
> cat file.txt
> hexdump -C file
> less file.txt
list the contents of a (text) file
hex dump of a file
another way to look at the contents of a file
> touch <file name>
create a file with that name
> tr <sa> <sb> < fin > fout
> cat fin | tr <sa> <sb>

translate the characters set in sa to the character set in sb for the characters in the file fin sending the output to fout
If you leave off the fout part, the result is sent to the screen
Second version uses the Unix concept of pipes, using the output of the cat command as the input of tr
Example:
> cat file.txt | tr [:lower:] [:upper:] - make all characters upper case
> cat file.txt | tr "abc" "xyz" - make a's x's, b's to y's and c's to z's
> mv <f1> <f2>
move (rename) a file
> rm <file name>
CAUTION: remove a file
> ^c
> ps
> <command> &
> ^z
> kill <process number>
control+c, kill the foreground process
status of processes, useful with background processes
run command in background
control+z, but current process into background
stop a background process
> exit end telnet session
> man sleep
> man 3 sleep
get manual help about a command, looks in section 1, command line commands, first
Look in man section 3, library functions callable from a user program
> echo $path | tr : \\n list the elements the path used to find an executable file, then one entry per line
> sysctl -a | grep cachesize get the cache sizes, sysctl is quite powerful


There are LOTS of other commands, and most commands have lots of options, but this should be enough to get you started.


Emacs:


Windows:

Command
(> represents the prompt,
do not type this character)
Generally spaces count on command lines
Effect
Many commands similar to UNIX commands
also, you can get Cygwin to add UNIX commands to your Windows system.
> cmd
Present a command mode window, looks like DOS and mostly works that way as well
> wmic:root\cli
Tells about CPU information

ND.