我最近需要一个空白的 PDF 页面(8.5" x 11" 大小)并意识到我不知道如何从命令行制作一个。
发出touch blank.pdf会产生一个空的 PDF文件。是否有生成空 PDF页面的命令行工具?
我正在使用 Adobe Source Code Pro 字体通过简单终端运行 Arch Linux。我的语言环境正确设置为LANG=en_US.UTF-8.
我想将代表扑克牌的 Unicode 字符打印到我的终端。我正在使用维基百科作为参考。
卡片套装的 Unicode 字符工作正常。例如,发行
$ printf "\u2660"
Run Code Online (Sandbox Code Playgroud)
在屏幕上打印一个黑色的心。
但是,我在使用特定的扑克牌时遇到了问题。发行
$ printf "\u1F0A1"
Run Code Online (Sandbox Code Playgroud)
打印符号?1而不是黑桃 A。怎么了?
这个问题在多个终端(urxvt、xterm、termite)和我尝试过的每种字体(DejaVu、Inconsolata)中仍然存在。
我使用 crouton 在 Toshiba chromebook 上运行 Ubuntu 14.04。安装我的操作系统的驱动器很小,只有 3.6 GB 的可用空间。我想sage在我的系统上安装,但系统上sage需要 6 GB 的可用空间。
但是,我总是将 SD 卡插入设备中。该卡有 175 GB 的可用空间。可以安装sage在SD卡上吗?
我尝试sage使用命令下载的方式
apt-add-repository -y ppa:aims/sagemath
apt-get update
apt-get install sagemath-upstream-binary
Run Code Online (Sandbox Code Playgroud)
如发现here。
我想递归查找*.pdf目录中~/foo基本名称与文件父目录名称匹配的每个文件。
例如,假设目录结构~/foo如下所示
foo
??? dir1
? ??? dir1.pdf
? ??? dir1.txt
??? dir2
? ??? dir2.tex
? ??? spam
? ??? spam.pdf
??? dir3
??? dir3.pdf
??? eggs
??? eggs.pdf
Run Code Online (Sandbox Code Playgroud)
运行我想要的命令会返回
~/foo/dir1/dir1.pdf
~/foo/dir2/spam/spam.pdf
~/foo/dir3/dir3.pdf
~/foo/dir3/eggs/eggs.pdf
Run Code Online (Sandbox Code Playgroud)
这是否可以使用find或其他一些核心实用程序?我认为使用-regex选项是可行的,find但我不确定如何编写正确的模式。
我有三个文件
~/naive-file.txt
~/old-text.txt
~/new-text.txt
Run Code Online (Sandbox Code Playgroud)
我想找到 的内容~/old-text.txt出现的每个实例,~/naive-file.txt并用~/new-text.txt. 我确定这是可行的sedorawk但我似乎无法找出正确的命令。这可能吗?
例如,假设的内容~/naive-file.txt是
$ cat ~/naive-file.txt
Sed id ligula quis est convallis tempor.
This is the old text.
It might have multiple lines and some special characters like these \ { & % #)!
etc...
Nunc aliquet, augue nec adipiscing interdum, lacus tellus malesuada massa, quis
varius mi purus non odio.
Run Code Online (Sandbox Code Playgroud)
假设内容~/old-text.txt是
$ cat ~/old-text.txt
This is the old text.
It …Run Code Online (Sandbox Code Playgroud) 我有一本json字典
$ cat foo.json
{
"black": "#073642",
"red": "#DC322F",
"green": "#859900",
"yellow": "#CF9A6B",
"blue": "#268BD2",
"purple": "#D33682",
"cyan": "#2AA198",
"white": "#EEE8D5",
"brightBlack": "#657B83",
"brightRed": "#D87979",
"brightGreen": "#88CF76",
"brightYellow": "#657B83",
"brightBlue": "#2699FF",
"brightPurple": "#D33682",
"brightCyan": "#43B8C3",
"brightWhite": "#FDF6E3",
"foreground": "#839496",
"background": "#002B36",
"cursorColor": "#839496"
}
Run Code Online (Sandbox Code Playgroud)
我想用来jq打印出这本字典中的所有值。所以,输出应该是:
$ jq 'magic' foo.json
#073642
#DC322F
#859900
#CF9A6B
#268BD2
#D33682
#2AA198
#EEE8D5
#657B83
#D87979
#88CF76
#657B83
#2699FF
#D33682
#43B8C3
#FDF6E3
#839496
#002B36
#839496
Run Code Online (Sandbox Code Playgroud)
'magic'我正在寻找什么?
命令
$ find ~/foo/ -type f -iname "*.txt" -print0 | parallel -0 cat
Run Code Online (Sandbox Code Playgroud)
使用GNU并行打印所有.txt下的文件~/foo/。
我有一个 python 脚本,我想在其中调用这个 bash 命令:
import subprocess, sys
def runBashCommand(my_command):
process = subprocess.Popen(my_command.split(), stdout=subprocess.PIPE)
output = process.communicate()[0]
return None
def makeCommand(my_path):
return "find {} -type f -iname \"*.txt\" -print0 | parallel -0 cat".format(my_path)
Run Code Online (Sandbox Code Playgroud)
发行
>>> makeCommand('~/foo/')
Run Code Online (Sandbox Code Playgroud)
返回
'find ~/foo/ -type f -iname "*.txt" -print0 | parallel -0 cat'
Run Code Online (Sandbox Code Playgroud)
但发出
>>> runBashCommand(makeCommand('~/foo/'))
Run Code Online (Sandbox Code Playgroud)
产生错误
find: paths must precede expression: |
Usage: find …Run Code Online (Sandbox Code Playgroud) 我最近从rxvt-unicode切换到st。这意味着我从$TERM=rxvt-unicode-256color到$TERM=st-256color.
我对切换很满意,并希望继续使用st. 但是,我注意到某些终端应用程序对新$TERM值不满意。例如,除非我“欺骗”它认为它是可识别的东西,emacs否则不会加载st全彩色支持。$TERM$TERM=xterm-256color
我的问题是:简单设置的风险是什么$TERM=xterm-256color?在我看来,重要的部分$TERM=*-256color是256color部分,而 的价值*似乎不那么重要。
我正在通过 crouton 在 Toshiba Chromebook 2 上运行 Ubuntu 14.04。
我最近重新格式化了一张 256GB 的 SD 卡,该卡一直保存在我的 chromebook 中。我的问题是,每次我在唤醒 Chromebook 后尝试访问我的 SD 卡时,都会收到一条消息
Authentication is required to mount SD256 (/dev/mmcblk1p1)
An application is attempting to perform an action that requires privileges.
Authentication is required to perform this action.
Action: org.freedesktop.udisks2.filesystem-mount
Vendor: The udisks Project
Run Code Online (Sandbox Code Playgroud)
我很好奇为什么每次唤醒我的 chromebook 时都必须验证我的 SD 卡,以及是否有办法改变它。
我在一个~/foo有子目录的目录中工作
~/foo/alpha
~/foo/beta
~/foo/epsilon
~/foo/gamma
Run Code Online (Sandbox Code Playgroud)
我想发出一个命令,检查每个“级别 1”子目录下的总大小,~/foo如果大小低于给定数量,则删除该目录及其内容。
因此,假设我想删除内容少于50K. 签发$ du -sh */退货
8.0K alpha/
114M beta/
20K epsilon/
1.2G gamma/
Run Code Online (Sandbox Code Playgroud)
我想我的命令来删除~/alpha,并~/epsilon与他们的内容一起。有这样的命令吗?我怀疑这可以通过find某种方式完成,但我不太确定如何。