|
Command |
Meaning |
|
ls |
list files and directories |
|
ls -a |
list all files and directories |
|
mkdir |
make a directory |
|
cd directory |
change to named directory |
|
cd |
change to home-directory |
|
cd ~ |
change to home-directory |
|
cd .. |
change to parent directory |
|
pwd |
display the path of the current directory |
|
cp file1 file2 |
copy file1 and call it file2 |
|
scp |
copy files/directories accross servers |
|
mv file1 file2 |
move or rename file1 to file2 |
|
rm file |
remove a file |
|
rmdir directory |
remove a directory |
|
cat file |
display a file |
|
less file |
display a file a page at a time |
|
head file |
display the first few lines of a file |
|
tail file |
display the last few lines of a file |
|
grep 'keyword' file |
search a file for keywords |
|
wc file |
count number of lines/words/characters in file |
|
command > file |
redirect standard output to a file |
|
command >> file |
append standard output to a file |
|
command < file |
redirect standard input from a file |
|
command1 | command2 |
pipe the output of command1 to the input of command2 |
|
cat file1 file2 > file0 |
concatenate file1 and file2 to file0 |
|
sort |
sort data |
|
who |
list users currently logged in |
|
* |
match any number of characters |
|
? |
match one character |
|
man command |
read the online manual page for a command |
|
whatis command |
brief description of a command |
|
apropos keyword |
match commands with keyword in their man pages |
|
ls -lag |
list access rights for all files |
|
chmod [options] file |
change access rights for named file |
|
command & |
run command in background |
|
^C |
kill the job running in the foreground |
|
^Z |
suspend the job running in the foreground |
|
bg |
background the suspended job |
|
jobs |
list current jobs |
|
fg %1 |
foreground job number 1 |
|
kill %1 |
kill job number 1 |
|
ps |
list current processes |
|
kill 26152 |
kill process number 26152 |
|
vi/vim |
text editor in UNIX |
|
ssh |
access to another server from one server |
|
history |
list commands which have been executed |
|
cksum |
check file size |
Monday, July 1, 2024
UNIX Commands
Friday, June 28, 2024
UNIX
What is UNIX?
UNIX is an operating system which has been under constant development. It is a stable, multi-user, multi-tasking system for servers, desktops and laptops. UNIX is widely used in computer network systems that have personal computers, workstations, etc.
UNIX systems also have a graphical user interface (GUI) similar to Microsoft Windows which provides an easy to use environment. However, knowledge of UNIX is required for operations which aren't covered by a graphical program, or for when there is no windows interface available.
Types of UNIX
The most distinctive characteristic of UNIX is that, unlike other operating systems, detailed contents of the operating system written in C language have been released to the public. For that reason, a great number of computer manufacturers can easily port it to the hardware of their own products. As a result, users are able to operate UNIX in all computer manufacturer products. There are many different versions of UNIX, although they share common similarities. The most popular varieties of UNIX are Sun Solaris, GNU/Linux, and MacOS X.
The UNIX operating system
UNIX is an operating system which can perform distributed processing in computer network environments. Its characteristics are mentioned below:
- Distributed processing is presupposed
- It was developed assuming that it would be used in workstations
- It provides the multi-user function, which enables simultaneous use by multiple users. In operating systems that provide the multi-user function, a procedure called log-in, to receive the service, and a procedure called log-out, to report completion, are required
- Through multi-programming, it can simultaneously process multiple jobs. In UNIX, this is called the multiprocessing function
- As a technology to connect computers of different manufacturers, the communication protocol called TCP/IP has been established
- It has instruction rights called commands that enable the user to use UNIX in an interactive mode. This function is called human interface, and has been implemented by X-Window
- The program development tools are abundant
UNIX is an operating system which can be simultaneously used by multiple users, and in which each user can simultaneously perform multiple job processing. The UNIX operating system is made up of three parts; the kernel, the shell and the programs.
The kernel
UNIX has a control program called Kernel, which has the following functions:
- It is the central part of the operating system, and controls the system resources
- It performs the process management. (Since UNIX is distributed-processing oriented, jobs are called processes)
The kernel of UNIX is the hub of the operating system: it allocates time and memory to programs and handles the filestore and communications in response to system calls.
The shell
The shell acts as an interface between the user and the kernel. The shell is a command line interpreter (CLI). It interprets the commands the user types in and arranges for them to be carried out. A shell has the following functions:
- It interprets the commands input by the users and calls the kernel function
- It executes a program called a shell script, which combines commands
Likewise, the command uses the devices connected to the system, and call the kernel function to use the command sets.
The commands are themselves programs: when they terminate, the shell gives the user another prompt.
A user logs in -> the login program checks the username and password -> the login program starts the shell
A user types a command -> the shell searches the filestore for the file containing the program (command) -> the shell requests the kernel through system calls to execute the program
The process (command) has finished running -> the shell returns the UNIX prompt
Filename Completion - By typing part of the name of a command, filename or directory and pressing the [Tab] key, the tcsh shell will complete the rest of the name automatically. If the shell finds more than one name beginning with those letters you have typed, it will beep, prompting you to type a few more letters before pressing the tab key again.
History - The shell keeps a list of the commands you have typed in. Use the cursor keys to scroll up and down to repeat a command or type history for a list of previous commands
Files and processes
Everything in UNIX is either a file or a process.
A process is an executing program identified by a unique PID (process identifier).
A file is a collection of data. They are created by users using text editors, running compilers etc.
Examples of files:
- a document
- the text of a program written in some high-level programming language
- instructions comprehensible directly to the machine and incomprehensible to a casual user, for example, a collection of binary digits (an executable or binary file);
- a directory, which may be a subdirectory and ordinary files.
The Directory Structure
All the files are grouped together in the directory structure.
Friday, June 21, 2024
Operating Systems
Operating system (OS) is system software that manages computer hardware and software resources and provides common services for computer programs.
Unix
Unix was originally written in assembly language then rewritten in C, developed into a large, complex family of inter-related operating systems which have been influential in every modern operating system.
“Unix-like” is commonly used to refer to the large set of operating systems which resemble the original UNIX.
“Unix-like” systems run on a wide variety of computer architectures. They are used heavily for servers in business, as well as workstations in academic and engineering environments. Free UNIX variants, such as Linux and BSD are popular in these areas.
MAC OS
MAC OS is a line of open core graphical operating systems developed, marketed and sold by Apple. MAC OS is a Unix-like operating system built on technology that had been developed at NeXT.
Steve Jobs, a co-founder of Apple, started NeXT, which developed NEXTSTEP operating system. NEXTSTEP would later be acquired by Apple and used along with code from BSD as the core of MAC OS.
Linux
Linux is Unix-like, but was developed without any Unix code.
GNU Project, started by Richard Stallman, was highly successful in duplicating the functionality of various parts of UNIX but development of GNU Hurd kernel proved to be unproductive. In 1991, Linus Torvalds released the first version of the Linux kernel. It was soon merged with the GNU user space components and system software to form a complete operating system.
The main characteristic is that the software is free. Since the source code has been released to the public, and redistribution and changes can be freely performed, a great number of people around the world have participated to make Linux a better OS. As a background factor, it should not be forgotten that the Internet expansion that enabled people around the world to communicate with each other allowed this participation.
The Linux kernel is used in some popular distributions, such as Red Hat, Debian, Ubuntu and Google’s Android.
Microsoft Windows
Microsoft Windows is a family of operating systems designed by Microsoft and primarily targeted to Intel architecture based computers.
Windows’ usage on servers is not as widespread as on personal computers as Windows competes against Linux for server market share.



