AIX basic operation commands

Source: Internet
Author: User
Tags echo command informix uncompress

I. Introduction to Aix
AIX is one of the versions of UNIX operating systems. It is mainly used on the IBM Xeon 6000 series computers. Other Unix systems, such as Sun's Solaris, hp unix, and Linux. Currently, the AIX system versions include AIX 4.x aix5.x. They only have different versions, but the kernel is the same, and the operating command machine is also the same. Some new commands are added when the version is high, which are backward compatible.

Ii. Getting started with Aix
For most users, access to Aix is via Telnet to log on to rs6000, of course, with different identities. Use the local machine as a terminal of rs6000 to perform operations on the R s6000. This is actually a major feature of Unix. UNIX itself is designed as a multi-task, multi-user concurrency system.

2.1 User Permissions
If the UNIX system is only used by the user, in addition to the system administrator account provided by the system, the user must create an account for himself. Because you must be very careful when using the system administrator account (Root), this account has special permissions. Unix has an embedded security mechanism. Generally, users do not have the permission to create new accounts or perform other system management operations. The root user uses the system administrator account, also known as a Super User, and has the privileges of the system administrator. However, accidental errors by the root user may cause system faults. Therefore, the user should enter his/her account for general work. Because he/she has no permissions, the system will not be faulty. In a multi-user environment, Super Users should be more careful in their work. Because his mistakes will not only affect him, but also affect others and the entire system.
UNIX also ensures that different users do not interfere with each other in a multi-user environment. each user has his/her own permissions and can select the group or other users to access his/her work. If you restrict the access permission to the owner, your data cannot be accessed by others. If a user participates in a group and performs a task together, the user can set the access permission as the owner and other members in the group. If user data allows any other user to view, the permission can be defined as anyone. For the definition of permissions, we will discuss it when introducing chomd commands.

2.2 logout
After the work is completed, the user needs to exit the system, which prevents others from intentionally or unintentionally accessing his files or using the system through the user's account. In any shell, the exit command is used to exit the shell. When a user exits from the login shell, the system automatically exits. You can also enter the logout command. $ Logout, or press Ctrl + D. For details about how to exit the system, see online help.

2.3 Basic commands
Telnet command
The Telnet command is used to log on to the AIX System on rs6000. Syntax:
Telnet + IP (Server IP address ). For example, if you log on to a server whose IP address is 192.168.0.161 and enter Telnet 192.168.0.161 at a Windows command prompt
With other Telnet software, you only need to set an IP address and then perform logon.

LS command
The LS command is used to display files in a specified path. The specific format is: ls + path.
Example: Display files in/home
$ Ls/home
$ LS-L + path: in addition to the file name, it also displays the attributes, Creation Time, and Group of the file.
$ LS-A + path to display hidden files.

Man command
Is the HELP command of Aix. It can display detailed instructions for using a command. This command is useful. The specific syntax is: $ man + command
Example: view the usage of the tar command
$ Man tar

CD command
Change the current working directory, similar to the CD command in DOS mode. The specific syntax is:
$ CD + path: Enter the/home/user directory and run the $ CD/home/USER command.
CD .. is returned to the upper-level directory. CD is to return to the directory where the previous step is located.
 
Who command
The WHO command is used to display the current online users. It is very easy to use. Simply enter who at the shell prompt.
$ Who

CP command
Used to copy files, similar to the Copy command in DOS. The specific syntax is:
CP + file name + path if you want to copy the directory, you need to add the parameter-R or-R
Example: $ CP/home/a.tar/home/demo
$ CP-r/home/AAA/home/BBB where AAA and BBB are directories.

MV command
Used to move files or folders. The specific syntax is:
MV + file name + path
For example, to move/home/long/a to the/home/long/B directory, run the following command:
$ MV/home/long/A/home/long/B

Rm command
Used to delete files or folders. The specific syntax is RM + path + file name. For example, to delete the/home/long/manual.tar file, run the following command: $ RM/home/long/manual.tar.
To delete a directory, use Rm-R + path + directory name. For example, to delete the/home/manual directory, use $ Rm-r/home/manual
Note: To delete a file or folder, you must first have the write permission on the folder.

Mkdir command
The specific syntax for creating a directory is mkdir + directory name. For example, to create a directory named test under the/home/long directory, run the following command:
$ Mkdir/home/long/test

Rmdir command
Unlike mkdir, it is used to delete a directory. (Note: This refers to an empty directory with no files in it.) The syntax is rmdir + directory name. For example, to delete the directory just created, run the following command: $ rmdir/home/long/test

Mkgroup command
Used to create a user group
For example, create a user group Informix with a group ID of 1000.
# Mkgroup id = 1000 Informix

Mkuser command
Create user
For example, create user Informix, which belongs to the Informix group, and set the login directory to/home/Informix.
# Mkuser pgrp = Informix home =/home/Informix

Chfs command
Expand File System
For example, expand the size of/home to 5 GB.
# Chfs-a size = 5g/home

VI command
VI commands are commonly used and important commands in Unix. You can edit one or more files in full screen mode. If no file is specified during VI Execution, the VI command will automatically generate an unknown and empty working file. If the specified file does not exist, create a new file based on the specified file name. If the modification to the file is not saved, the v I command does not change the content of the original file. For VI commands, refer to the relevant help manual.
Note: The vi command does not lock the edited object. Therefore, multiple users may edit an object at the same time, and the last saved file version will be retained.

Cat command
It is used to display the file content on the standard output, but does not update the file. The syntax is cat + file name. For example, to display the content of the/home/Informix/. profile file, run the following command:
$ CAT/home/Informix/. Profile

Find command
Used for file search
For example, search for files starting with cd_image.
$ Find/-name 'CD _ image *'
Note: The find command is complex. Currently, only simple applications are mastered. To solve this problem in depth, you can view the relevant documentation or enter man find on the terminal to view it.

More command
The function is to display text files on the terminal screen by screen. The specific syntax is: More + file name. For example, to split the screen to display the file/example. C, run the following command: $ more/example. C.

Shutdown command
The shutdown command interrupts the Operating System. Only users with root permissions can execute this command. By default, a message is received when the shutdown command is executed. The shutdown operation is not completed until the complete shutdown information is received. When the shutdown time is approaching, the user will receive a warning message on the client. When the specified time arrives, the system ends all processes (6 0 s by default) and unmounts all file systems. The specific usage is:
# Shutdown shut down the system
# Shutdown-fr Quickly shut down the system and restart
# Shutdown-F Quickly shut down the system

Talk command
The talk command is used to talk to other end users. The specific syntax is as follows:
$ Talk username1 @ rs6k where user is the account name of the target user. At the same time, run $ talkusername2 @ rs6k on the peer terminal (rs6k indicates the server name)

Wall command
It is used to send broadcasts to all users in the network. Syntax: Wall + content
For example, the following command: $ wall good morning!
Good morning is displayed on all terminals!

Date command
Used to display or change the time. If you change the time, You must log on as the root user. For example, to display the time, enter $ date.
To change the time input: # date 0217142592 change time to, January 1, February 17, 1992

Clear command
Eliminate terminal screens. The specific syntax is very simple. You only need to execute $ clear.

Whereis command
Used to determine the file location. Usage: whereis + file name. For example, to determine the location of the file example.txt, run the following command: $ whereis example.txt

Tar command
Tar is a common and important command in UNIX. The tar command Copies files on the disk to the file media (for example, from a floppy disk to a hard disk or from a hard disk to a floppy disk ), or recover the recorded files from the archive media to files on the disk. In case of an error, the T ar command does not provide any restoration operations.
Tar command format:
# Tar-CVF (or xvf) + file name + device
C-> Local to other devices
X-> other devices to the local device
R-> is to add a file (such as a t.txt file ).
A tar file (or folder) uses the CVF parameter;
Unbind the tar file and use the xvf parameter.
For example, run the following command to tar the files in/home/test to/ANW and tar them into exe.tar:
# Tar-CVF/ANW/exe.tar/home/test
To unbind the tar file, run the following command:
# Tar-xvf/ANW/exe.tar will remove exe.tar to the path specified during compression.
The extension of the tar command to generate a file can be arbitrary. For example, the file generated by the test file can be test. A and test. B extension test.tar.
Compress command and uncompress command
These two commands are used to complete compression and decompression. For example, if you run $ compress test.tar, The test.tarfile is compressed into the test.tar. Z file. Uncompress command: $ uncompress test.tar. Z
Note: If the absolute path is input during compression, it is automatically extracted to the corresponding path during decompression.

DF command
The DF command displays the total disk space and available disk space of the system. It also displays the file system parameters of the specified device, the path of the file system, and the directory to which the file system is mounted. The syntax is as follows: $ DF is 512 KB, and $ DF-K is 1024 kb, that is, 1 MB:
$ DF
Filesystem 512-blocks free % used iused % iused mounted on
/Dev/hd4 327680 239248 27% 2616 4%/
/Dev/hd2 11730944 5539296 53% 84989 6%/usr
/Dev/hd9var 327680 301088 9% 709 2%/var
/Dev/hd3 327680 316448 4% 68 1%/tmp
/Dev/hd1 10092544 1426480 86% 9128 1%/home
$ DF-K
Filesystem 1024-blocks free % used iused % iused mounted on
/Dev/hd4 163840 119624 27% 2616 4%/
/Dev/hd2 5865472 2769648 53% 84989 6%/usr
/Dev/hd9var 163840 150544 9% 709 2%/var
/Dev/hd3 163840 158224 4% 68 1%/tmp
/Dev/hd1 5046272 713236 86% 9128 1%/home

Finger command
Displays information about the currently logged on user. This command has the same function as the f command. The syntax is as follows:
$ Finger or $ F

Last Command
The last command is used to display the previous logon information. For example, last displays the logon information of all users in the recent period. Including the logon time and process. If you specify to display the login information of a user, you can use the last + user account. For example, $ last user indicates the logon information of the user.

Ifconfig command
Used to configure or display TCP/IP network interface parameters. You can run the following command to view the IP Address:
$ Ifconfig-A displays the IP address on rs6000.

Ping Command
Used to test the physical connection of the network. The user sends an ICMP (Internet Control Message Protocal) to obtain an ICMP response from the host or gateway. To test the physical connection with a host whose IP address is 192.168.0.161, run the following command:
$ Ping 192.168.0.161
Ping 192.168.0.161: (192.168.0.161): 56 data bytes
64 bytes from 192.168.0.161: icmp_seq = 0 TTL = 255 time = 0 MS
64 bytes from 192.168.0.161: icmp_seq = 1 TTL = 255 time = 0 MS
64 bytes from 192.168.0.161: icmp_seq = 2 TTL = 255 time = 0 MS
64 bytes from 192.168.0.161: icmp_seq = 3 TTL = 255 time = 0 MS
64 bytes from 192.168.0.161: icmp_seq = 4 TTL = 255 time = 0 MS
64 bytes from 192.168.0.161: icmp_seq = 5 TTL = 255 time = 0 MS
64 bytes from 192.168.0.161: icmp_seq = 6 TTL = 255 time = 0 MS
---- 192.168.0.161 Ping statistics ----
8 packets transmitted, 8 packets received, 0% packet loss
Round-trip min/AVG/max = 0/0/0 MS
In this case, the system receives a response from 192.168.0.161, proving that the physical connection to the host is normal.
If the following problem occurs, it indicates that there is no connection with 192.168.0.161.
$ Ping 192.168.0.161
Ping 192.168.0.161: (192.168.0.161): 56 data bytes
---- 123.123.1.1 Ping statistics ----
53 packets transmitted, 0 packets received, 100% packet loss

Su command
Used to change the user ID, together with the session. For example, if the current user is user1 and $ su-user2 is executed, the user ID is changed to user2 and can be operated as user2. When creating a user, you can choose whether to allow other users to Su your user.

Ps command
Displays the status of the currently running process. With different options, you can query all running processes or all processes with the user ID. Through the ps command, you can understand the processes that are running in the background or all the processes that have the user I D. With the ps command, you can understand the processes that are running in the background and the batch processing processes that are running. If no parameter is specified, only processes created by the current terminal are displayed. $ PS-A lists detailed information about processes running in the system. $ Ps a lists all processes related to the terminal.

Echo command
Used to output string standards. For example, to output hello, you can use $ echo hello
In the variable assignment statement, for example, u = Hello, to output hello, use $ echo $ U. Note that a $ symbol must be added before, indicating the value of the output variable U.

Env command
The env command can be used to display the current environment or set one or more environment variables. You can also run the specified command. However, environment changes are only valid during command execution. For example, $ ENV allows you to view the currently set environment variables. For example:
$ ENV
_ =/Usr/bin/env
Lang = en_us
Login = Informix
Cl1__passthru = 1
Path =/usr/IBM/Informix/bin:/usr/bin:/etc:/usr/sbin:/usr/UCB:/home/Informix/bin: /usr/bin/X11:/sbin :.
Lc1_fastmsg = true
LOGNAME = Informix
Mail =/usr/spool/mail/Informix
Locpath =/usr/lib/NLS/Loc
User = Informix
Authstate = compat
Shell =/bin/KSh
Odmdir =/etc/objrepos
Pam_service = Su
Home =/home/Informix
Informixdir =/usr/IBM/Informix
Term = xterm
Mailmsg = [you have new mail]
Iteconfigsrv =/etc/imnsearch
Onconfig = onconfig. ifxserver_demo
Pwd =/Informix
Z = BEIST-8
Iteconfigcl =/etc/imnsearch/clients
Ite_doc_search_instance = search
Informixserver = ifxserver_demo
A _ z =! LOGNAME

Passwd command
When a user logs on, the system requires the user to enter the user name and password. Although users do not have a password, most users use the password for logon. If you want to change the password, you can use the passwd command. When executing the passwd command, the system first requires the user to enter the current password, and then enter the new password two times in a row. The new password is valid only when the new password is the same. For example, to change the password of Informix, run the following command:
$ Passwd Informix
Changing password for "Informix"
Informix's old password:
Informix's new password:
Enter the new password again:

Chmod command
To enhance the security of directories or files, or grant directories and files to others for access, users often need to modify the permissions of directories or files. In UNIX, the permission uses an octal number (0 to 7) to specify the permission for a file or directory. There are three types of objects used for directories or files:
Owner: the user who created the file
Group members: other members in the user group of the owner
Other users: they are neither the owner nor other users of group members.
The system uses an octal number to specify the permissions of each type of visitor object. For the owner, group members, and other users, the file permission can be divided into read permission, write permission, and execution permission. Each permission corresponds to a bit of data. That is, if the read bit is 1, it indicates readable, the write bit is 1, and the execution bit is 1, it indicates executable.
Note that bit execution is special for directories. If you can execute a directory, you can access the contents of the directory. Otherwise, you cannot access the contents of the directory.
You can use the CHMOD command to assign a new permission value to a file or directory.
For example, set the file testfile permission to: the owner can read, write, and execute, and the group members can read and other users can execute.
$ Chmod 741 testfile
$ LS-l
Total 202
-RW ------- 1 Informix system 287 Dec 28 mbox
Drwxr-XR-x 3 Informix system 512 Dec 29 15:05mm
-RW-r -- 1 Informix system 59034 Dec 29 Smit. Log
-RW-r -- 1 Informix system 12668 Dec 21 Smit. Script
Drwxr-XR-x 3 Informix system 512 Dec 27 Test
-RW-r -- 1 Informix system 10240 Dec 28 test.tar
-RW-r -- 1 Informix system 16949 Dec 10 websm. Log
Note that in the first column on the left, the first character is-indicating the file; and d indicates the directory. Each of the following nine characters is a group (in octal format) that represents the user, the group in which the user is located, and the read and write executable permissions of other users. R indicates readable, W indicates writable, and X indicates executable.

Lssrc command
Lssrc-A # view all system group services
Lssrc-A | grep active # view all started services
Lssrc-g tcpip # obtain the status of the TCPIP subsystem Group
Startsrc/stopsrc-g tcpip # Start the entire TCPIP system group
Startsrc/stopsrc-s iptrace # Start a single Subsystem
Stopsrc-s iptrace-F # force stop Subsystem
Stopsrc-A # Stop all active subsystems of the machine

2.4 configure Environment Variables
In order to allow users to use shell conveniently and flexibly, Unix introduces the concept of environment. The environment is some data. You can change the data, add new data, or delete some data. These data are called environment variables. Because they define the user's work environment and can be modified at the same time.
2.4.1 browse and set Environment Variables
Each user has its own different environment variables. You can use the Env command (without parameters) to browse the environment variables. The output format and variable name vary with Shell and system configuration. Example:
$ ENV
_ =/Usr/bin/env
Lang = en_us
Login = long
Nlspath =/usr/lib/NLS/MSG/% L/% N:/usr/lib/NLS/MSG/% L/% N. Cat
Imqconfigcl =/etc/imnsearch/dbcshelp
Path =/usr/bin:/etc:/usr/sbin:/usr/UCB:/home/long/bin:/usr/bin/X11:/sbin :.
Lc1_fastmsg = true
Cgi_directory =/var/docsearch/cgi-bin
Imqconfigsrv =/etc/imnsearch
LOGNAME = long
Mail =/usr/spool/mail/long
Locpath =/usr/lib/NLS/Loc
User = long
Document_server_machine_name = localhost
Authstate = compat
Shell =/usr/bin/KSh
Odmdir =/etc/objrepos
U = rs6k
Document_server_port = 49213
Home =/home/long
Term = VT100
Mailmsg = [you have new mail]
Pwd =/home/long
Document_directory =/usr/docsearch/html
Z = BEIST-8BEIDT
A _ z =! LOGNAME
$
Sometimes you have many environment variables. If you only want to query one of them, you can use the echo command. As mentioned earlier, to indicate that the input characters represent environment variables, you must add $. note that there is no space between $ and the variable name. For example, use the echo command to display the value of the environment variable home:
$ Echo $ home
/Home/long
You can assign values to environment variables to generate new environment variables. You can assign values to existing environment variables to change their original values.

2.5 Public desktop environment CDE
CDE stands for Common Desktop Environment, which is a graphical interface management program. The prerequisite for using CDE is that rs6000 is connected to a graphic display. Before use, install the software packages X.11 and DT. RTE and x11.dt. helpinfo. during installation, the system sets CDE as the default user interface. After AIX is started, the CDE registration interface is displayed. Enter the user registration name and password to enter the CDE operation environment.

2.6 Unix kernel and Shell
Unix kernel: a core program that runs and manages hardware devices such as disks and printers.
Shell is a system user interface that provides an interface for user and internal and interactive operations. Shell has its own programming language for editing commands. It allows you to write a program composed of shell commands. Currently, shell has the following versions: Bash (Linux), K shell (Aix), and C Shell

2.7 Unix File System Hierarchy
UNIX manages resources in a file system. File systems include dynamic file systems and static file systems. Dynamic File System: executable file and configuration file static file system: Operating System
The basic hierarchy of UNIX file systems is as follows:
/Usr/lib/sbin is mainly used to store system library files and some backup files.
/Etc is mainly a system configuration file
/Dev Device File
/Var Log File
/Tmp temporary file
/OPT application file

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.