Calculator.
bc [Link] = Would result in 3, see below notes.
bc
sqrt ( E ), length ( E ), scale ( E )
Quit : Exits the bc command.
Calendar
cal cal - Would give you the calendar for this month.
cal 12 2000 - Would give you the calendar for December of 2000.
vi [Link]
Edits the file [Link].
vi
Esc:q!
Typing the above command would exit the vi edit done with the above
command.
View a file.
cat
Cat [Link]. Reads [Link]
C compiler.
cc
cc myfile.c - would compile the file myfile.c.
Change directory.
cd cd ../home/users/computerhope
cd
clear Clears screen.
Compare files.
cmp cmp [Link] [Link] - Compares file1 to file2 and outputs results. Below is
example of how these results may look.
[Link] [Link] differ: char 1011, line 112
Copy files.
cp
cp [Link] [Link]
Copies the [Link] in the [Link] in current directory.
date Tells you the date and time in Unix.
Displays text after echo to the terminal.
echo
echo Hello world
The above example would return "Hello world" to the console
exit Exit from a program, shell or log you out of a Unix network.
Finds one or more files assuming that you know their approximate filenames.
find find -name '[Link]'
In the above command the system would search for any file named
[Link] in the current directory and any subdirectory.
grep command searches the given file for lines containing a match to the given
strings or words. By default, grep prints the matching lines. Use grep to search
grep for lines of text that match one or many regular expressions, and outputs only
the matching lines.
grep 'word' filename
ls Lists the contents of a directory.
In the above example this command would list each of the files in the current
directory and the files permissions, the size of the file, date of the last
modification, and the file name or directory. Below is additional information
about each of the fields this command lists.
ls -l
Permissions Directories Group Size Date Directory or file
drwx------ 2 users 4096 Nov 2 19:51 mail/
drwxr-s--- 35 www 32768 Jan 20 22:39 public_html/
-rw------- 1 users 3 Nov 25 02:58 [Link]
Display a manual of a command.
man
man mkdir - Lists help information on the mkdir command.
Create a directory.
mkdir
mkdir mydir - This would create a new directory called mydir.
Reports the process status.
Typing ps alone would list the current running processes. Below is an example
of the output that would be generated by the ps command.
ps Where PID is process id, TTY is terminal that is process attach to, CMD is
command that is running
PID TTY TIME CMD
6874 pts/9 0:00 ksh
6877 pts/9 0:01 csh
418 pts/9 0:00 csh
ps -ef
Display full information about each of the processes currently running.
UID PID PPID C STIME TTY TIME CMD
hope 29197 18961 0 Sep27 ? [Link] sshd: hope@pts/87
hope 32097 29197 0 Sep27 pts/87 [Link] -csh
hope 7209 32097 0 12:17 pts/87 [Link] ps -ef
ps -l
Displays processes including those that are in a wait state, similar to the below
example.
pwd Print the current working directory.
Deletes a file without confirmation (by default).
rm [Link]
rm
Remove the file [Link] without prompting the user.
rm -r directory
Remove a directory, even if files existed in that directory.
Displays a count of lines, words, and characters in a file
wc wc [Link]
5 13 57 [Link] 5 = Lines,13 = Words,57 = Characters
Sort command sort the lines of a file or files, in alphabetical order. for
example if you have a file named testfile with these contents
zzz
aaa
1234
yuer
wer
Sort qww
wwe
Then running sort testfile will give us output of
1234
aaa
qww
wer
wwe
yuer
zzz