Solaris 常用命令

更改用户默认shell

在/etc/passwd里修改用户默认shell

/bin/bash

 

1.services 文件只读

chmod 777 /etc/services
vi /etc/services

之后,再改回去

 如何使.profile修改后生效

.  $HOME/.profile  ( for Bourne shell or Korn shell)
or
source ~/.profile  ( for C shell)

 

磁盘的大小

df -ahk

du -Lsh

du是查看当前文件夹的大小;df是查看磁盘的大小

 

ln –s sourcedir  targetlink

建软连接
用ln命令建的连接:hard link 和symbolic link有什么区别

To Link a File to a File

ln [ -f | -n ] [ -s ] SourceFile [ TargetFile ]

To Link a File or Files to a Directory

ln [ -f | -n ] [ -s ] SourceFile ... TargetDirectory

Description

The ln command links the file designated in the SourceFile parameter to the file
designated by the TargetFile parameter or to the same file name in another
directory specified by the TargetDirectory parameter. By default, the ln command
creates hard links. To use the ln command to create symbolic links, designate
the -s flag.

A symbolic link is an indirect pointer to a file; its directory entry contains
the name of the file to which it is linked. Symbolic links may span file systems and may refer to directories.

If you are linking a file to a new name, you can list only one file. If you are
linking to a directory, you can list more than one file.

The TargetFile parameter is optional. If you do not designate a target file, the
ln command creates a new file in your current directory. The new file inherits
the name of the file designated in the SourceFile parameter. See example 5.

    Notes:

      1. You cannot link files across file systems without using the -s flag.
      2. If TargetDirectory is already a symbolic link to a directory, then the
         ln command treats the existing target as a file. This means that a
         command such as ln -fs somepath/lname symdir will not follow the
         existing symbolic link of symdir, instead it will create a new symbolic
         link from somepath/lname to symdir.
Flags

-f Causes the ln command to replace any destination paths that already exist. If
a destination path already exists and the -f flag is not specified, the ln
command writes a diagnostic message to standard error without creating a new
link and continues to link the remaining SourceFiles.

-n Specifies that if the link is an existing file, do not overwrite the contents
of the file. The -f flag overrides this flag. This is the default behaviour.

-s Causes the ln command to create symbolic links. A symbolic link contains the
name of the file to which it is linked. The referenced file is used when an open
operation is performed on the link. A stat call on a symbolic link returns the
linked-to file; an lstat call must be done to obtain information about the link.
The readlink call may be used to read the contents of a symbolic link. Symbolic
links can span file systems and refer to directories.

    Note: Absolute path names must be used when specifying the SourceFile
    parameter for the -s flag. If the absolute path name is not designated,
    unexpected results may occur when the SourceFile and the TargetFile
    parameters are located in different directories. The source file does not
    need to exist before creating the symbolic link.
Exit Status

This command returns the following exit values:

0 All specified files were successfully linked.

>;0 An error occurred.

Examples

  1. To create another link (alias) to a file, enter:

     ln  -f chap1  intro

     This links chap1 to the new name, intro. If intro does not already exist,
     the file name is created. If intro does exist, the file is replaced by a
     link to chap1. Then both the chap1 and intro file names will refer to the
     same file. Any changes made to one also appear in the other. If one file
     name is deleted with the rm command, the file is not completely deleted
     since it remains under the other name.
  2. To link a file to the same name in another directory, enter:

     ln  index  manual

     This links index to the new name, manual/index.

         Note: intro in example 1 is the name of a file; manual in example 2 is
         a directory that already exists.

  3. To link several files to names in another directory, enter:

     ln  chap2  jim/chap3  /home/manual

     This links chap2 to the new name /home/manual/chap2 and jim/chap3 to
     /home/manual/chap3.
  4. To use the ln command with pattern-matching characters, enter:

     ln  manual/* .

     This links all files in the manual directory into the current directory, .
     (dot), giving them the same names they have in the manual directory.

         Note: You must type a space between the asterisk and the period.

  5. To create a symbolic link, enter:

     ln -s /tmp/toc toc
     This creates the symbolic link, toc, in the current directory. The toc file
     points to the /tmp/toc file. If the /tmp/toc file exists, the cat toc
     command lists its contents.

     To achieve identical results without designating the TargetFile parameter,
     enter:

     ln -s /tmp/toc

Files

/usr/bin/ln Contains the ln command.

Related Information

The cp command, mv command, rm command.

The link subroutine, readlink subroutine, stat subroutine, symlink subroutine.

Directory Overview in AIX 5L Version 5.2 System User's Guide: Operating System
and Devices describes the structure and characteristics of directories in the
file system.

Files Overview in AIX 5L Version 5.2 System User's Guide: Operating System and
Devices describes files, file types, and how to name files.

Linking Files and Directories in AIX 5L Version 5.2 System User's Guide:
Operating System and Devices explains the concept of file linking.

Linking for Programmers in AIX 5L Version 5.2 General Programming Concepts:
Writing and Debugging Programs discusses links from a programming viewpoint.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值