Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4584643
  • 博文数量: 1214
  • 博客积分: 13195
  • 博客等级: 上将
  • 技术积分: 9105
  • 用 户 组: 普通用户
  • 注册时间: 2007-01-19 14:41
个人简介

C++,python,热爱算法和机器学习

文章分类

全部博文(1214)

文章存档

2021年(13)

2020年(49)

2019年(14)

2018年(27)

2017年(69)

2016年(100)

2015年(106)

2014年(240)

2013年(5)

2012年(193)

2011年(155)

2010年(93)

2009年(62)

2008年(51)

2007年(37)

分类: BSD

2009-04-05 18:19:20

3.2.6 改变控制台的显示模式

3.3.2 FreeBSD File Flags
# chflags sunlink file1
# chflags nosunlink file1
# ls -lo file1

The nosuid mount(8) option will cause these binaries to silently fail. That is, they will fail to execute without ever alerting the user. That option is also not completely reliable as a nosuid wrapper may be able to circumvent it; according to the mount(8) manual page.

Even though the shell script in question is an executable file, it will not run with a different EUID or effective user ID. This is because shell scripts may not access the setuid(2) system calls.

/boot/defaults/     Default bootstrapping configuration files; see loader.conf(5).
/etc/defaults/       Default system configuration files; see rc(8).
/etc/namedb/       named configuration files; see named(8).
/etc/periodic/      Scripts that are run daily, weekly, and monthly, via cron(8); see periodic(8).
/etc/ppp/             ppp configuration files; see ppp(8).
/proc/                  Process file system; see procfs(5), mount_procfs(8).
/rescue/              Statically linked programs for emergency recovery; see rescue(8).
/tmp/                  Temporary files. The contents of /tmp are usually NOT preserved across a system reboot. A memory-based file system is often mounted at /tmp. This can be automated using the tmpmfs-related variables of rc.conf(5) (or with an entry in /etc/fstab; see mdmfs(8)).
/usr/libdata/     Miscellaneous utility data files.
/usr/libexec/     System daemons & system utilities (executed by other programs).
/usr/obj/           Architecture-specific target tree produced by building the /usr/src tree.
/var/yp             NIS maps.

Any files that are in the B1 or B2 directories can be reached with the path /A1/B1 or /A1/B2 as necessary. Any files that were in /A1 have been temporarily hidden. They will reappear if B is unmounted from A1.

The root file system can be mounted read-only, making it impossible for you to inadvertently delete or edit a critical file. Separating user-writable file systems, such as /home, from other file systems also allows them to be mounted nosuid; this option prevents the suid/guid bits on executables stored on the file system from taking effect, possibly improving security.
FreeBSD automatically optimizes the layout of files on a file system, depending on how the file system is being used. So a file system that contains many small files that are written frequently will have a different optimization to one that contains fewer, larger files. By having one big file system this optimization breaks down.

FreeBSD features the growfs(8) command, which makes it possible to increase the size of file system on the fly.

ad       ATAPI (IDE) disk
da       SCSI direct access disk
acd     ATAPI (IDE) CDROM
cd       SCSI CDROM
fd        Floppy disk

passno

    This determines the order in which file systems should be checked. File systems that should be skipped should have their passno set to zero. The root file system (which needs to be checked before everything else) should have its passno set to one, and other file systems' passno should be set to values greater than one. If more than one file systems have the same passno then fsck(8) will attempt to check file systems in parallel if possible.

mount
-a
    Mount all the file systems listed in /etc/fstab. Except those marked as “noauto”, excluded by the -t flag, or those that are already mounted.
-f
    Force the mount of an unclean file system (dangerous), or forces the revocation of write access when downgrading a file system's mount status from read-write to read-only.
The -o option takes a comma-separated list of the options, including the following:
noexec
    Do not allow execution of binaries on this file system. This is also a useful security option.
nosuid
    Do not interpret setuid or setgid flags on the file system. This is also a useful security option.

Each process is uniquely identified by a number called a process ID, or PID, and, like files, each process also has one owner and group. The owner and group information is used to determine what files and devices the process can open, using the file permissions discussed earlier. Most processes also have a parent process. The parent process is the process that started them. For example, if you are typing commands to the shell then the shell is a process, and any commands you run are also processes. Each process you run in this way will have your shell as its parent process. The exception to this is a special process called init(8). init is always the first process, so its PID is always 1. init is started automatically by the kernel when FreeBSD starts.

One of the most useful sets is auxww. a displays information about all the running processes, not just your own. u displays the username of the process' owner, as well as memory usage. x displays information about daemon processes, and ww causes ps(1) to display the full command line for each process, rather than truncating it once it gets too long to fit on the screen.
PIDs are assigned starting from 1, go up to 99999, and wrap around back to the beginning when you run out (a PID is not reassigned if it is already in use). 当您运行到超过限制时,这些编号会回转分配.
TIME is the amount of time the program has been running on the CPU, as most programs spend a lot of time waiting for things to happen before they need to spend time on the CPU.

top command to look up memory.
One for total size, and one for resident size--total size is how much memory the application has needed, and the resident size is how much it is actually using at the moment.

FreeBSD sends the process the Segmentation Violation signal (SIGSEGV). If an application has used the alarm(3) system call to be alerted after a period of time has elapsed then it will be sent the Alarm signal (SIGALRM).SIGTERM and SIGKILL SIGHUP, SIGUSR1, and SIGUSR2

# /bin/kill -s HUP 198
Why Use /bin/kill?: Many shells provide the kill command as a built in command; that is, the shell will send the signal directly, rather than running /bin/kill. This can be very useful, but different shells have a different syntax for specifying the name of the signal to send. Rather than try to learn all of them, it can be simpler just to use the /bin/kill ... command directly.
/bin/kill -s KILL 1    quick way to shutdown your system.

shell
USER         Current logged in user's name.
PATH         Colon-separated list of directories to search for binaries.
DISPLAY     Network name of the X11 display to connect to, if available.
SHELL         The current shell.
TERM         The name of the user's type of terminal. Used to determine the capabilities of the terminal.
TERMCAP     Database entry of the terminal escape codes to perform various terminal functions.
OSTYPE         Type of operating system. e.g., FreeBSD.
MACHTYPE     The CPU architecture that the system is running on.
EDITOR         The user's preferred text editor.
PAGER         The user's preferred text pager.
MANPATH     Colon-separated list of directories to search for manual pages.

Under csh or tcsh a command like this would set EDITOR to /usr/local/bin/emacs:
% setenv EDITOR /usr/local/bin/emacs
Under Bourne shells:
% export EDITOR="/usr/local/bin/emacs"

# echo "/usr/local/bin/bash" >> /etc/shells
% chsh -s /usr/local/bin/bash

You can look through the boot messages again by viewing /var/run/dmesg.boot.

The online manual is divided up into numbered sections:

   1.User commands.
   2.System calls and error numbers.
   3.Functions in the C libraries.
   4.Device drivers.
   5.File formats.
   6.Games and other diversions.
   7.Miscellaneous information.
   8.System maintenance and operation commands.
   9.Kernel developers.

You can use man to search for keywords in the command descriptions by using the -k switch:
% man -k mail        == apropos mail

So, you are looking at all those fancy commands in /usr/bin but do not have the faintest idea what most of them actually do? Simply do:
% cd /usr/bin
% man -f *
or
% cd /usr/bin
% whatis *
阅读(1346) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~