小编psm*_*ars的帖子

当文件被移动时,它们是否存储在内存中?

当我使用该mv命令移动文件时,是否首先读取该文件,将其完全缓存到内存中,然后另存为另一个文件?或者和写作一样

while read line; do
    echo "$line" >> output_file
done < input_file
Run Code Online (Sandbox Code Playgroud)

cp. 将一个文件复制到另一个文件时,是否先将文件完全缓存到内存中,然后再复制?

shell memory files

6
推荐指数
1
解决办法
1505
查看次数

为什么我不能做 ls -a 1&gt;&amp;-?

为什么我们不能关闭stdout一个进程?

我正在尝试重定向命令。以下工作:

ls -a 0>&-
ls -a 2>&-
Run Code Online (Sandbox Code Playgroud)

这意味着关闭stdinstderr过程ls -a。但是为什么关闭stdout失败呢?我正进入(状态

aniket@aniket-Compaq-610:~/Downloads$ ls -a 1>&-
ls: write error: Bad file descriptor
Run Code Online (Sandbox Code Playgroud)

我知道在这里关闭标准输出没有意义,但我想知道为什么不允许这样做?

io io-redirection file-descriptors

6
推荐指数
1
解决办法
861
查看次数

为什么 pvremove 在手册页中有重复的“力”?

> man pvremove
PVREMOVE(8)            System Manager's Manual           PVREMOVE(8)

NAME
       pvremove — remove a physical volume

SYNOPSIS
       pvremove    [--commandprofile    ProfileName]    [-d|--debug]
       [-h|--help]    [-t|--test]     [-v|--verbose]     [--version]
       [-f[f]|--force   [--force]]   [--reportformat   {basic|json}]
       [-y|--yes] PhysicalVolume [PhysicalVolume...]

DESCRIPTION
       pvremove wipes the label on a device  so  that  LVM  will  no
       longer recognise it as a physical volume.

OPTIONS
       See lvm(8) for common options.

       -ff, --force --force
          Force the removal of a physical volume belonging to an
          existing volume group.  Normally vgreduce(8) should be
          used  instead  of …
Run Code Online (Sandbox Code Playgroud)

linux rhel lvm

6
推荐指数
2
解决办法
3485
查看次数

“su”,当密码未知但您在“轮子”中且“无密码”时

我在FreeBSD 11.我有一个用户“user123”属于组车轮具有%wheel ALL=(ALL) NOPASSWD: ALL/usr/local/etc/sudoers

我不知道root的密码。但是,我可以在没有“sudo”的情况下运行“sudo”。

我已经安装了 Postgresql 并通过“服务启动”运行它。

现在我想以 postgresql 用户身份登录并创建一个数据库或其他东西:

$ su postgres
Password:


# or

$ su - postgres
Password:
Run Code Online (Sandbox Code Playgroud)

但是我不知道密码。

这是用户的密码root还是用户的密码postgres?我不认识他们中的任何一个。有没有标准的解决方法?

freebsd users password root sudo

5
推荐指数
1
解决办法
3046
查看次数

为什么“requiretty”不起作用?

我的理解是该requiretty选项不允许在 PTY 上使用 sudo。

我的虚拟机sudoers

#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
Defaults        passwd_tries=3
Defaults        badpass_message="WRONG PASSWORD T_T"
Defaults        log_input, log_output, iolog_dir="/var/log/sudo"
Defaults        requiretty
# Host alias specification

# User alias specification …
Run Code Online (Sandbox Code Playgroud)

ssh debian sudo

5
推荐指数
1
解决办法
431
查看次数

如何使用shell脚本从另一台服务器删除文件

假设我们有两个服务器“A”和“B”。

服务器 B:

目录结构: /a/b/c/

上面的目录有以下文件:

2016xzy
2016abc
2016pqr
2015ghj
Run Code Online (Sandbox Code Playgroud)
  1. 我想删除所有名称以2016服务器 B ( /a/b/c/)开头的文件。

  2. shell 脚本应该在服务器“A”上。

  3. 模式(即2016)应该被当作 shell 脚本中的一个变量。

shell scripting

4
推荐指数
1
解决办法
1179
查看次数

为什么 ksh93 在 AIX 中不支持其内置 printf 的 %T 格式说明符?

我们在许多 AIX 5.3/6.1 系统中使用 ksh93 测试了以下命令printf,但它们都失败并得到相同的结果。

这是为什么?

# 
# oslevel -s                               
6100-07-09-1341
# 
# 
# ksh93 -c 'echo ${.sh.version}'
Version M-12/28/93e
# 
# 
# ksh93 -c 'printf "%T\n" "now"'      
ksh93[1]: printf: T: unknown format specifier
# 
# 
Run Code Online (Sandbox Code Playgroud)

ksh aix

4
推荐指数
1
解决办法
449
查看次数

标签 统计

shell ×2

sudo ×2

aix ×1

debian ×1

file-descriptors ×1

files ×1

freebsd ×1

io ×1

io-redirection ×1

ksh ×1

linux ×1

lvm ×1

memory ×1

password ×1

rhel ×1

root ×1

scripting ×1

ssh ×1

users ×1