我有大文本文件(1.5 G),
我想知道 Linux 中最快、最可靠的工具是什么。
我通常使用:
awk '!x[$0]++' file.txt
Run Code Online (Sandbox Code Playgroud)
但是当我使用htop命令时,我看到我的内存使用量在增加。
我想知道对于大文件来说什么是最快和更可靠的。
uniq?
sort?
sed?
awk?
Run Code Online (Sandbox Code Playgroud)
为什么?
我在用户的主目录中,我这样做:
ls -a
Run Code Online (Sandbox Code Playgroud)
然后它向我显示了我用户目录中的大量隐藏文件和目录。我可以删除其中哪些?
我的系统需要哪些?
我怎么能意识到呢?
我有一个 bash 脚本做了很多事情,称为script.sh:
#!/bin/bash
#It
#Is
#Doing
#Things
Run Code Online (Sandbox Code Playgroud)
有没有办法可以从自身内部获取此脚本的进程 ID,然后在 5 分钟后将其杀死?
喜欢:
#!/bin/bash
#Get pid of script.sh here, start a 5 minute timer and kill the script after time runs out
#It
#Is
#Doing
#Things
Run Code Online (Sandbox Code Playgroud) 我/part在我的机器上做了一个分区,里面有一些重要的数据......
但我受不了它的名字......
我想要一个明确的解决方案来解决它并将其名称更改为例如/test...
如您所见,这是我的/etc/fstab信息:
# /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 even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda5 during installation
UUID=a21a99c4-e5b4-4197-ac5e-80d0fab1f30c …Run Code Online (Sandbox Code Playgroud) 什么是mknod命令参数?
我想在 chroot 中创建一个监狱。所以我需要这样做:
mknod /var/chroot/bind/dev/null c 1 3
mknod /var/chroot/bind/dev/random c 1 8
Run Code Online (Sandbox Code Playgroud)
什么是c,1,3和8?
这是我的简单 bash:
cat test.sh
#!/bin/bash
echo "hello"
su - root -c /path/to/script.sh <<EOF
password
EOF
whoami
echo "good bye"
Run Code Online (Sandbox Code Playgroud)
但我收到此错误:
./test.sh
hello
su: must be run from a terminal
<current-user>
good bye
Run Code Online (Sandbox Code Playgroud)
(或者)
cat test2.sh
#!/bin/bash
echo "hello"
sudo su <<EOF
password
EOF
whoami
echo "good bye"
Run Code Online (Sandbox Code Playgroud)
又一个错误
(或者)
cat test3.sh
#!/bin/bash
echo "hello"
su root <<EOF
password
EOF
whoami
echo "good bye"
Run Code Online (Sandbox Code Playgroud)
又是错误...
当我尝试:
#!/bin/bash
echo "hello"
sudo -s <<EOF
<password>
echo Now I am root
id
echo "yes!" …Run Code Online (Sandbox Code Playgroud) 我有以下命令,但它对我不起作用...
cd /etc/postfix/ssl/ && openssl genrsa -des3 -rand /etc/hosts -out smtpd.key 1024 <<PASS
password
password
PASS
Run Code Online (Sandbox Code Playgroud)
输出是:
109 semi-random bytes loaded
Generating RSA private key, 1024 bit long modulus
...............................++++++
...........++++++
e is 65537 (0x10001)
Enter pass phrase for smtpd.key:
Run Code Online (Sandbox Code Playgroud)
它应该自动回答问题并自动输入密码。
我总是HEREDOC用于在 bash 上自动化我的问答并且工作正常......
这里有什么问题?
可能是因为安全问题,但是我们如何处理这样的问题呢?
我也知道这个问题,但无法解决。
我正在尝试这个:(没有结果)
#!/bin/bash
PASS="password"
printf '%s\n' "$PASS" | {
openssl genrsa -des3 -rand /etc/hosts -out smtpd.key 1024 -passout fd:3
} 3<&0
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
我听说如果你不在 linux 中做分区,恢复数据是很困难的。如果你做几个分区,恢复数据会很容易。
例如,如果你让它/par1 /part2 /part3更好地恢复。
但是现在我的一些朋友告诉我,这/home/user/{all data here}与/par1 /part2 /part3关注康复没有区别。
哪一个是真的,为什么?
我在 CentOS 版本 6.6 上的目录中处于 root 中,我想执行以下操作以便在 CentOS 上的高版本中安装 mysql:
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
Run Code Online (Sandbox Code Playgroud)
之后我有以下错误:
Retrieving https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
curl: (77) Problem with the SSL CA cert (path? access rights?)
error: skipping https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm - transfer failed
Run Code Online (Sandbox Code Playgroud)
这是我的uname -a:
Linux hosting 2.6.32-504.3.3.el6.x86_64 #1 SMP Wed Dec 17 01:55:02 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
Run Code Online (Sandbox Code Playgroud)
这是我的基本回购:
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors …Run Code Online (Sandbox Code Playgroud) 我想知道是否有办法编译 C、C++ 和 Python 代码,以便无法在 Linux 上对其进行逆向工程?
我听说在 Windows 上有一些方法可以做到这一点,但我正在使用 Linux。
我想安全地编译我的代码,如已发布或最终版本。
更新
至少我想让普通用户很难拆卸,
我在 C 和 C++ 中使用 GCC,如果你向我介绍最好的 Python 编译器,我将不胜感激。
linux ×4
bash ×3
files ×2
partition ×2
security ×2
awk ×1
c ×1
c++ ×1
centos ×1
compiling ×1
devices ×1
ext4 ×1
filesystems ×1
fstab ×1
hard-disk ×1
kill ×1
logs ×1
memory ×1
mount ×1
mysql ×1
process ×1
python ×1
rename ×1
repository ×1
sed ×1
shell ×1
signals ×1
sort ×1
ssl ×1
su ×1
sudo ×1
uniq ×1