我可以使用cat反引号将文件内容粘贴到命令中:
ls `cat filenames`
Run Code Online (Sandbox Code Playgroud)
有没有办法做相反的事情 - 将字符串转换为(临时)文件名?
gcc -o cpuburn `uncat "main(){while(1);}"`.c
Run Code Online (Sandbox Code Playgroud) 这是错误:
~]$ ./jdev_suite_121200_linux64.bin
0%....................................................................................................100%
Not enough disk space in dir /tmp/sfx_bG4Mlk, requires at least -1893 MB disk space
** Error during execution, error code = -1.
Run Code Online (Sandbox Code Playgroud)
编辑:
~]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/dm-3 50G 25G 22G 54% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 1.6M 1.9G 1% /dev/shm
tmpfs 1.9G 1.1M 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
tmpfs 1.9G 904K 1.9G 1% /tmp
/dev/sda2 477M 130M 319M 29% /boot
/dev/sda1 …Run Code Online (Sandbox Code Playgroud) 起初我想在我没有 root 访问权限的服务器上安装一个包。由于我没有 root 访问权限,因此我尝试自己构建它,但在配置阶段出现错误。
这是我运行的命令:
cd ~
git clone https://github.com/stella-emu/stella.git
cd stella/
./configure --prefix=$HOME/atari
Run Code Online (Sandbox Code Playgroud)
然后我收到以下错误:
Running Stella configure...
mkdir: cannot create directory `/tmp/cg-2059': Permission denied
config.guess: cannot create a temporary directory in /tmp
Looking for C++ compiler... none found!
Run Code Online (Sandbox Code Playgroud)
有什么办法可以解决这个问题吗?
以下是一些诊断信息
-bash-4.2$ ls -ld /tmp
drwxr-xr-x 7 root root 4096 Dec 9 20:39 /tmp
-bash-4.2$ find /tmp -mindepth 1 -maxdepth 1 -printf x | wc -c
12
-bash-4.2$ mkdir ~/tmp
-bash-4.2$ ls
amin bs94 Maildir public_html skel.tar.gz speedtest_cli.py speedtest.py …Run Code Online (Sandbox Code Playgroud) 我正在尝试从 Arch 用户存储库 (AUR) 安装 android-studio。我有一个错误,设备上没有剩余空间
Arch 用户存储库 (AUR) 的输出 - 详细信息
Dload Upload Total Spent Left Speed
100 737M 100 737M 0 0 4497k 0 0:02:48 0:02:48 --:--:-- 4908k
-> Found android-studio.desktop
==> Validating source files with sha256sums...
android-studio-ide-171.4443003-linux.zip ... Passed
android-studio.desktop ... Passed
==> Extracting sources...
-> Extracting android-studio-ide-171.4443003-linux.zip with bsdtar
==> Entering fakeroot environment...
==> Starting package()...
==> Tidying install...
-> Removing libtool files...
-> Purging unwanted files...
-> Removing static library files...
-> Compressing man and …Run Code Online (Sandbox Code Playgroud) 根据我自己的经验,我注意到大多数人使用 /tmp/ 作为临时文件或保存磁盘写入,但我不经常看到有人推荐甚至使用 /dev/shm 代替。
这是为什么?
在这里不抱希望,但是是否有一些内置的日志记录机制,通过它我可以找出在重新启动时从 /tmp 中删除了哪些文件?我显然可以调整关闭脚本,但这不是我要问的。
以前 mktemp 用于在/tmp. 今天我注意到 mktemp 正在创建文件而 $PWD不是在/tmp?
笔记:
我能够做到:ls /tmp
$ mktemp --version
mktemp (GNU coreutils) 8.30
Run Code Online (Sandbox Code Playgroud)
$ echo $TMPDIR
$
Run Code Online (Sandbox Code Playgroud) 我的错误:
ln "99700.fa821246f01ef7f3d86a503e33de5753b50640d69de790fd3db5a5dc31ffa45d1dc64a93f950379ee432aa27cbb0593e6e50ddbb6f8a7e279afaf90cec961233.png" /home/anon/foo.png
# ^ works fine ^
ln "99700.fa821246f01ef7f3d86a503e33de5753b50640d69de790fd3db5a5dc31ffa45d1dc64a93f950379ee432aa27cbb0593e6e50ddbb6f8a7e279afaf90cec961233.png" /tmp/foo.png
ln: failed to create hard link '/tmp/foo.png' => '99700.fa821246f01ef7f3d86a503e33de5753b50640d69de790fd3db5a5dc31ffa45d1dc64a93f950379ee432aa27cbb0593e6e50ddbb6f8a7e279afaf90cec961233.png': Invalid cross-device link
Run Code Online (Sandbox Code Playgroud)
这里的答案指出:https : //unix.stackexchange.com/a/108558/79280
您的 /home 目录很可能与 /root 目录不在同一分区上。
您可以使用 cat /etc/fstab 轻松检查这一点 无法在不同分区之间创建硬链接,只有符号链接可以。
但是,正如您所看到的:
cat /etc/fstab ? 1 ?
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works …Run Code Online (Sandbox Code Playgroud) tmp ×8
files ×3
linux ×3
filesystems ×2
command-line ×1
gnu ×1
hard-link ×1
ln ×1
mktemp ×1
permissions ×1
shell ×1
size ×1
xfs ×1