Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the common commands in Solaris

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you what Solaris commands are commonly used, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Note: to modify after entering the command under solaris, you need to use the delete key. It is also inconvenient to call up the history command, and the up and down arrow keys do not work. We need to enter the bash environment by entering exit when # bash exits. In the bash environment is similar to the doskey function, you can record the history of commands, press the arrow key can normally display the command just struck, you can also enter history to display the entire history of command records.

1. System

# passwd: change password

# exit: exit the system

two。 File

# cp: copy files or directories. Parameter:-a recursive directory,-I overwrite confirmation

# mv: rename Mobile

# rm: delete. Parameter:-r recursively delete

3. Catalogue

# mkdir: create a directory

# rmdir: delete an empty directory

# cd: change the working directory

# pwd: view the current path

# ls: column directory, parameters:-an all files,-c sorted by time,-l details

4. Text

# sort: sort

# uniq: delete duplicate lines

5. Backup compression

# tar: file, parameter:-c create new file,-r append to the end,-t list file content,-u update file,-x release file,-f use archive file or device,-M multi-volume,-v detailed report,-w confirm every step. Example tar cvf text.tar * .txt

# gzip: compression and decompression. Parameters:-d decompression,-r recursive compression

# unzip: decompress. Parameter:-d directory,-x decompress

6. Authority

# chmod: change permissions, r is readable, w is writable, x is executable. 0 indicates no permissions, 1 indicates executable permissions, 2 indicates writable permissions, 4 indicates readable permissions, and then adds them. For example, if you want the owner of a file to have read / write permissions, you need to put 4 (readable) + 2 (writable) = 6 (read / write).

# chgrp: change the user group

# chown: change ownership

7. Administration and Management

# wall: send messages to all logged-in users

# write: send a message to a user

# mesg y: set to allow others to send messages to themselves

# sync: cache synchronization check

# shutdown: shutdown. Parameters:-r restart,-h shutdown without restart,-f fast shutdown,-c cancel shutdown

# free: view memory

# uptime: displays the running time of the system

# df: disk footprint. Parameter:-a shows all file systems.

# du: disk usage

# dd: copy and format conversion

# fdformat: low-frame floppy disk

# echo: display text

# cal: calendar

# date: system date and time

# clear: clear the screen

8. My memories, by tom2sun.

# who: view the current user

# finger: view other user information

# rlogin: remote login

# rcp: remote replication

# netstat: network status

# cat: full display at once

# more: split screen display

# file: list file types

# grep: find content

# find: find files

# ps: currently running the program, parameter-a shows all processes

# at: time, command, Ctrl+D ends

# lp: printing

# nice: specify priority

# renice: adjust priority

# kill: terminates the process

# man: get command help

# touch: change the time record

# ln: link

# mount-t vfat / dev/hda1 / mnt/dos: Mount Dos partition (not applicable to Unix-Center)

9. FTP

# ftp: start the FTP program

Ftp >

Open: open

Close: off

Bye: leave

Get: download

Put: upload

Mget/mput: download / upload multiple files

Reget: resuming download

Binary: binary transfer file

Ascii:ASCII code transmission

Cd: changing remote directories

Lcd: change the local directory

Mkdir: create a directory

Rmdir: deleting a directory

Delete: deleting fil

Mdelete: delete more than one at a time

Rename: renaming

Status: display statu

Prompt: interactive

Hash: display # (hash) for every 1024 bytes transferred

Size: displaying file siz

Reset: reset

10. Vi

AQuery I: enter the input state

ESC: returns the command status

Command mode

Qquit: exit

11. Fast keys and others

Alt+F1~F6: access to multiple virtual consoles (not applicable to Unix-Center)

Tab: command completion

End &: background process

-

Hardware system:

1. How to check the status of cpu?

# psrinfo-v

# mpstat can list the status of multiple cpu loads

2. How to view the memory?

# prtconf | grep 'Memory' can check the amount of memory.

# / usr/platform/sun4u/sbin/prtdiag

3. How to add swap partitions dynamically? # $su-root-become a superuser

# mkfile 100m / home/swapfile-create a 100m Swap file

# / usr/sbin/swap-a / path/filename-activate the Swap file

# / usr/sbin/swap-l-verify the swap file

# / usr/sbin/swap-d / path/filename-cancel the swap file

# rm-rf / home/swapfile-Delete swap file

4. How to check the speed at which the current network card is rising?

# dmesg | grep Link

5. How to adjust the resolution and refresh frequency of x-window?

Login to the character interface, run: # / kdmconfig

6. How to use optical and floppy drives?

In general, use:

# / etc/init.d/volmgt start

# volcheck

The above methods are not good, use:

# / etc/init.d/volmgt stop

# mount-F hsfs-o ro / dev/dsk/c0t6d0s0 / cdrom-attach the CD-ROM drive

# mount-F pcfs / dev/diskette0 / floppy-attach floppy drive

Solaris defines the system disk file system description:

Ufs-UNIX file system. Is the default file system for Solaris.

Hsfs-A high-density CD-ROM file system that is read-only.

Pcfs-PC file system that supports DOS formatted floppy disks

7. What is the naming convention for SCSI devices?

For the use of hard drives with bus controllers, the hard disk naming habits of bus controllers are listed below:

CWtXdYsZ

C Logical controller number

T Physical bus target number

D Drive number

S Slice (or partition) number (0 to 7)

For example:

/ dev/rdsk/c0t0d0s0 the original interface corresponds to the first piece (root) of the first hard disk of the first SCSI destination address of the first controller

/ dev/rdsk/c0t0d0s2 the original interface corresponds to the third piece of the first hard disk on the first SCSI destination address of the first controller.

8. How to check the usage of the hard disk?

# df-k  can see the size of the installed file system and the amount of space left.

# quota-v  looks at the user's disk space information, if you use quota to limit the amount of user space.

# du-sk *  to view directory usage

# du-k | sort-n can quickly discover which directory is the largest.

9. How to view the physical information of the hard disk?

The command # format can also view the type and partition details of the hard disk.

# iostat-E  look at the size and model of the hard drive

# prtvtoc / dev/rdsk/c0t0d0s0 shows the partition status of a disk

10. Check the system kernel commands.

# isainfo check the bit of the kernel

# isainfo-kv adjusts the kernel

# modinfo displays loadable modules

# prtconf display system hardware configuration (peripherals)

# sysdef displays loadable modules, hardware configuration and some core reference values that can be adjusted

# ulimit-a

11. Print the current OBP version number

# prtconf-V

OBP 3.20.0 2000-10-24 10:47

# / usr/platform/sun4u/sbin/prtdiag-v | grep OBP

OBP 3.20.0 2000-10-24 10:47 POST 6.1.0 2000-10-24 10:49

Ok. .version

Release 3.20 Version 0 created 2000-10-24 10:47

OBP 3.20.0 2000-10-24 10:47

POST 6.1.0 2000-10-24 10:49

OBDIAG 4.5.1 2000-10-24 10:48

12. View and boot the 32-bit or 64-bit kernel mode of the system

64-bit mode

# isalist-v

Sparcv9+vis sparcv9 sparcv8plus+vis sparcv8plus sparcv8 sparcv8-fsmuld sparcv7 sparc

# isainfo-v

64-bit sparcv9 applications

32-bit sparc applications

# isainfo-b

sixty-four

Start 64-bit kernel mode

Ok. Boot kernel/sparcv9/unix

32-bit mode

# isalist-v

Sparcv8plus+vis sparcv8plus sparcv8 sparcv8-fsmuld sparcv7 sparc

# isainfo-v

32-bit sparc applications

# isainfo-b

thirty-two

Start 32-bit mode

Ok. Boot kernel/unix

13. Determine the current refresh rate of the monitor

# / usr/sbin/fbconfig-rev\?

14. How to configure the network card ip?

# ifconfig-a-- check the Nic, such as hme0

# ifconfig hme0 unplumb-stop the network card

# ifconfig hme0 plumb-start the network card

# ifconfig hme0 inet 192.168.2.3 netmask 255.255.255.0 up-add ip and subnet mask

# vi / etc/defaultrouter add ip for default route

# vi / etc/hostname.hme0 add hostname

# vi / etc/nodename add hostname

# vi / etc/resolv.conf

Domain china.com your domain name

Nameserver 202.106.0.20 the nds ip you use

# vi / etc/nsswitch.conf change hosts:file dns

15. PROM status commands and parameters

Format: OK >; instruction

Command description

Banner displays the current machine configuration status, CPU, memory, hostid,EtherNet

Probe-scsi shows the device to which the internal SCSI channel is attached

Probe-scsi-all displays all SCSI channels and attached devices

Probe-ide displays all IDE channels and attached devices (for U10Magi U5)

Devalias display device aliases such as cdrom,disk,disk0,disk1, etc.

Printenv has no parameters, displays environment variables or

Parameter is the name of the environment variable such as: printenv auto-boot?

Setenv sets environment variables, such as: setenv auto-boot? False

Predetermined values of set-default recovery environment variables such as: set-default auto-boot?

Set-defaults restores all environment variable predetermined values

Boot device option starts the host

Device alias: cdrom or disk

Device name: / pci@1f,4000/scsi@3,1/disk@6,0:f

Option-r device configuration

-s single user

Eject cdrom | floppy pops up cdrom or floppy

Reset reset

Test net

Watch-net-all

Show-devs

16. Find the name of the network card and the number of interfaces

# grep network / etc/path_to_inst

17. How can a network card set three ip with different subnet masks?

For example, the network card name is hme0:

# vi / etc/hosts

127.0.0.1 localhost

192.168.2.1 dbs loghost

192.168.9.15 dd

192.168.9.65 aa

# vi / etc/netmasks

192.168.2.0 255.255.255.0

192.168.9.0 255.255.255.192

192.168.9.64 255.255.255.252

# vi / etc/hostname.hme0

Dbs

# vi / etc/hostname.hme0:1

Dd

# vi / etc/hostname.hme0:2

Aa

# ipconfig hme0 inet 192.168.2..1 netmask 255.255.255.0 up

# ipconfig hme0:1inet 192.168.9.15 netmask 255.255.255.192 up

# ipconfig hme0 inet 192.168.9.65 netmask 255.255.255.252 up

# init 6

# ipconfig-a

18. How to view the fiber optic hard disk in prom?

Stop + an enters the ok state:

Ok >; select fiber card device name (can be viewed with show-devs)

Ok >; show-children

19. Host dual screen setting.

1.Confirm there are two Video Cards .

2.Confirm driver installed and patches installed if need .

3.vi / usr/dt/config/Xservers.

Comment the last line.

And uncomment the nearest line like this.

4.reboot.

20. Check the hard disk parameters and their physical addresses:

# format; test.out

In this way, the character ^ M (\ 015) in test.dat can be removed and test.out can be generated.

11. Shutdown command.

The way to shut down the system varies according to the reason for the shutdown. The shutdown is performed either to go to execution level S or to stop the operating system and power off the device.

(1) / usr/sbin/shutdown-gtime-ilevel-y

(2) init 0

(3) halt

4) STOP+A; sync

(5) turn off the power

In case of emergency, press Stop_A. If Stop_A does not work, turn the device off and on again. This is

Extreme circumstances. These two methods are not cleanly closed, they are suddenly closed and are used only in emergencies.

12. How to send instant messages under Solaris?

Use the wirte command to the terminal of a single user.

$wirte username

Enter the message body, press ctrl-d at the end, and the message will appear in the user terminal.

The user can use mesg n [y] to decide whether to start accepting messages or not.

With wall, it is sent to all system users.

$wall

Hello, i love you. End with ctrl-D.

Rwall-n netgroup to all users on the network.

$rwall-n workgroup-sent to each user under the group workgroup

Hi! No smoking. End with ctrl-d

$rwall sune450-or the host name is sune450. The usage is as above.

13, the system is sunos5.8, I do not know why the only ordinary users can not afford Terminal, vi, etc., but super users can, how to remedy?

Replace the .cshrc in the login path with / etc/skel/local.cshrc, log in again, and OK!

$cp / etc/skel/local.cshrc. /

14. What does this question mean when you turn it off?

/ usr/sbin/vold: [ID 244572 daemon.error] there was a problem uninstalling / vol; interrupting system call

Uxwdog [ID 248799 daemon.error] error communicating with server (Broken pipe)

When you start / VOL before you uninstall it, there is a problem. Run:

# umount-f / vol before doing it.

15. Common examples of find:

Command format: find dir-name filename command

Example:

# find. -name hello-print looks for documents called hello in the current directory and all subdirectories.

# find. -ctime + 7-print to find documents that have not been changed in seven days

# find. -size + 2000m-print to find documents larger than 2000 bytes in size

# find / tmp-user b1234567-print documents under b1234567 in / tmp

# find. -name'* .c'- exec rm {} delete all .c files

# find. -name test\ *-print displays the file names of the current directory and its subdirectories whose first four digits are test

16. What if I forget solarsi's root password?

Method 1:

1. Don't be afraid, come with me.

two。 Put your solaris CD in cdrom

3. Type stop+a

4. When the word 'ok'' appears, type boot cdrom-s

5.cd / tmp

6.mkdir / tmp/xxx (it doesn't matter what the xxx is)

7.mount / dev/dsk/c0t0d0s0 / tmp/xxx (here c0t0d0s0 is your root disk)

8. Run csh

9. Export TERM or

Setenv TERM vt220

10.cp / tmp/root/xxx/shadow/ tmp/root/xxx/shadow/shadow.backup

11.vi / tmp/root/xxx/shadow and delete the root item in password.

twelve。 Reboot, and you can log in as root without a password, and then change your password.

If there is no shadow, delete the X after the root user name in / etc/passwd, and it will be fine.

Method 2:

Find a systematic solaris machine, put the system that forgot your password into mount, and repeat the steps after method-10.

Solaris for x86 machines:

Boot with the CD and exit to become a single user when you are asked to install it. The rest of the operation is as above.

17. Decompress  of common files

Generally speaking, under solaris, there are several formats of software:

1) for the file at the end of .gz, we use gunzip or gzip-d to extract it, and then tar to extract it.

2) the file at the end of .tar, we must know how to extract it in tar xvf format.

3) for the file at the end of the .zip, we use unzip. Note that this is only available in the higher version of solaris. And the file format to solaris patch more.

4) We usually use uncompress to extract the files at the end of Z (of course, everyone's habits are different.)

The above is about decompression. Generally, after decompression, several ways will be generated:

1) generate a .local file, at this time, we use: pkgadd-d xxx.local to install.

2) generate a directory, and there will be some pkg information in that directory, we use: pkgadd-d. ; means to install in the current directory and follow the default path.

3) generate a numeric directory, which usually refers to the patch of solaris. At this time, we use patchadd to install.

18. How to replace a character segment in a file in the command line interface?

# vi file enter in command mode:

: 1, $s/diag/peng/g find diag in the whole file and replace it with peng

19. Under what circumstances are TERM=VT100 and TERM=dtterm set?

In general, if you log in on the machine's monitor or through XMANAGER, the default is dtterm,telnet, which is usually ansi. When you modify a file through telnet, you need to set it to TERM = VT100; export

TERM

20. How to check the version of the system?

$uname-X

$more / etc/release

21. Enter CDE on the command line:

# / usr/dt/bin/dtlogin-daemon;exit

Or

# / etc/rc2.d/S92dtlogin start;exit

22. Check the meaning of the error code returned during patch installation:

# more / usr/sbin/patchadd

23. How to log in from one SOL8 machine to another SOL8 CDE desktop.

Click the menu when logging in to CDE: select-- Log in to the remote host--

24. How to check your default locale? C.Arthur

# more / etc/default/init

25. How to change the permissions of / home?

Stop the autofs service, or comment out the home of / etc/auto_master:

# vi / etc/auto_master

-the contents are as follows-

# Master map for automounter

#

+ auto_master

/ net-hosts-nosuid,nobrowse

# / home auto_home-nobrowse

/ xfn-xfn

Third-party software applications or techniques:

1. View the current bind version information

# nslookup-class=chaos-q=txt version.bind

2. Display the system-specified message when logging in?

# vi / etc/motd-delete all obsolete messages and enter new messages

Note: this message is not displayed for users who are logged in and are using the system, and messages beyond one screen cannot be displayed. Each time the file is modified, the timestamp of the file is updated.

3. Remove ^ M from the text

# dos2unix aaa.txt bbb.txt, the ^ M in aaa.txt is removed and the bbb.txt file is generated.

4. Find and package the txt files from 7 days ago in the system.

# find /-mtime-7 >; aaa.txt

# tar cvf bbb.tar-I aaa.txt

-find out that the files are recorded in the aaa.txt file and are made into a bbb.tar package.

5. Find and delete files that are older than one day:

# find. !-mtime -; | / usr/bin/xarys rn-rf

6. The solution to the problem of incorrectly entering Chinese for ordinary solaris9 users:

In the user directory, modify the following in # vi .profile:

Stty cs8-istrip

7, how to prevent telnet landing in a daze for too long to be kicked?

Here, vi / etc/default/login

# TIMEOUT sets the number of seconds (between 0 and 900) to wait before

# abandoning a login session.

#

# TIMEOUT=300

The changes do not take effect immediately, and all login session after that meet this requirement, but connections that have been established before the changes are not affected.

8. How to install gcc.

Go to sunfreeware.com to download the gcc version of the pkg package for the corresponding platform.

# pkgadd-d gcc*

Set the environment variable:

Shell for bash and sh:

Vi $home/.profiel

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/etc:/usr/local/bin:/usr/ccs/bin;export PATH

CC=gcc;export CC

Shell of csh:

Vi $home/.cshrc

Set path= (/ bin / usr/bin / usr/ucb / etc / usr/local/bin / usr/local/sbin.

Setenv CC gcc

9. List the directories under the current directory.

Ls-al | grep'^ d'

Use the command line to open a new terminal.

/ usr/dt/bin/dtterm

X86 or Vmware:

1. The method of attaching window98 partition on Solaris10 x86.

# mount-F pcfs / dev/dsk/c0d1p0:e / mnt

To sum up:

My hard disk is connected to the slaver disk of IDE1. With the above command, you can hang the E: disk on / mnt.

Under the catalog. If your computer has only one hard drive and is connected to the IDE1 slot on the motherboard, set it to

Master disk (usually in this case), now you want to hang the D: disk under WIN98, you can enter

# mount-F pcfs / dev/dsk/c0d0p0:d / mnt

Note that / mnt can be changed to any other empty directory, such as / data (I am in the file manager myself

A new directory), which can be changed to

# mount-F pcfs / dev/dsk/c0d0p0:d / data

If there is no error prompt after pressing enter, you can go to the attached folder (here is / data) to find the files on the D: partition of your attached win98.

The above is all the contents of this article "what are the Common Solaris commands?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report