Unix & Linux

Linux,FreeBSD和其他类似Un * x的操作系统用户的问答

3
-b在bash shebang中做什么?
我有以下bash脚本: #!/bin/bash -e egrep "^username" /etc/passwd >/dev/null if[ $? -eq 0 ] then echo "doesn't exist" fi 没有-e,该脚本将无法运行。什么是-e这个脚本呢?另外,$?在这种情况下该怎么办?
32 linux  bash 


3
使软件包明确安装在pacman中
我有一个软件包安装在我的PC上,作为对另一个软件包的依赖性。 我想显式安装该软件包,但不实际重新安装它或下载任何文件。 这可能吗? 更新: 我没有在中缓存任何程序包/var/cache/pacman/pkg,这就是我要更改程序包详细信息而无需重新安装的原因之一。 即使我已经缓存了软件包,运行pacman -S也会意味着整个安装过程都在运行,我也想避免。


6
用硬链接替换文件到/ dev / null
我正在运行一个写入log.txt的应用程序。该应用程序已更新为新版本,从而使受支持的插件不再兼容。它将大量错误输入到log.txt中,并且似乎不支持写入其他日志文件。 如何将它们写入其他日志? 我曾考虑用硬链接(应用程序无法分辨出区别吗?)或指向/ dev / null的硬链接替换log.txt。我有什么选择?

6
Crontab在/etc/cron.d中永远不会运行
这是我对Debian Jessie所做的事情: 通过安装cron apt-get install cron 放入backup_crontab文件/etc/cron.d/ 但是,该任务永远不会运行。 以下是一些输出: /# crontab -l no crontab for root /# cd /etc/cron.d && ls backup_crontab /etc/cron.d# cat backup_crontab 0,15,30,45 * * * * /backup.sh >/dev/null 2>&1 是否需要做一些事情来激活特定的crontab或激活cron“服务”本身?
32 debian  cron 

2
清除apt-get列表
我正在为基于Debian的嵌入式Linux构建映像。我apt-get update之前曾在要用作该图像基础的设备上使用过,所以下面的列表/var/lib/apt/lists非常大(大小接近100 MB)。 我想保留apt-get功能(因此,我不想删除apt储存库),但是我想释放这些列表中使用的空间(列表几乎是图像大小的两倍)。 有谁知道这是怎么做到的吗?我可以删除下面的文件/var/lib/apt/lists吗?

5
如何为公钥ssh授权而不是密码授权解锁帐户?
ssh不允许我登录,因为帐户已锁定。我想解锁服务器上的用户以通过ssh进行公钥授权,但不启用密码登录。 我试过了: # passwd -u username passwd: unlocking the password would result in a passwordless account. You should set a password with usermod -p to unlock the password of this account. 验证日志条目: Mar 28 00:00:00 vm11111 sshd[11111]: User username not allowed because account is locked Mar 28 00:00:00 vm11111 sshd[11111]: …
32 ssh  password 


13
使用sshfs由对等方重置连接
我使用的是保险丝/ sshfs安装架,到目前为止效果良好。现在,我不得不重新安装服务器系统,突然发现经典read: Connection reset by peer错误。我正在使用公共密钥身份验证,并将我的密钥复制到了新安装的系统中。正常的ssh登录可以正常工作。我将日志更改为调试,但是可惜的是这没有给我任何有用的信息: sshd[2077]: debug1: Forked child 2198. sshd[2198]: Set /proc/self/oom_score_adj to 0 sshd[2198]: debug1: rexec start in 5 out 5 newsock 5 pipe 7 sock 8 sshd[2198]: debug1: inetd sockets after dupping: 3, 3 sshd[2198]: Connection from 192.168.1.6 port 47991 sshd[2198]: debug1: Client protocol version 2.0; …
32 ssh  sshfs 


6
删除所有的at工作
我知道要删除at必须使用的预定作业atrm "numjob1 numjob2",但是是否有一种简单的方法可以对所有作业执行此操作?
32 command-line  at 


2
有unix命令行工具可以分析字体文件吗?
给定一个字体文件目录(TTF和OTF),我想检查每种字体并确定它是什么样式(常规,斜体,粗体,粗体斜体)。是否有针对UNIX风格的操作系统的命令行工具可以做到这一点?还是有人知道如何从TTF或OTF字体文件中提取元数据?

10
如何在模式(标记)之前将文件的内容插入另一个文件?
File1 内容: line1-file1 "1" line2-file1 "2" line3-file1 "3" line4-file1 "4" File2 内容: line1-file2 "25" line2-file2 "24" Pointer-file2 "23" line4-file2 "22" line5-file2 "21" 执行完perl / shell脚本后,File2内容应变为: line1-file2 "25" line2-file2 "24" line1-file1 "1" line2-file1 "2" line3-file1 "3" line4-file1 "4" Pointer-file2 "23" line4-file2 "22" line5-file2 "21" 即,将File1in 的内容粘贴在File2包含“ Pointer”的行之前。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.