AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-582361

devilz's questions

Martin Hope
devilz
Asked: 2017-06-10 21:41:58 +0800 CST

如何让手表在屏幕中央显示其输出?

  • 1

每次我在终端中使用 watch 命令时,输出都是从屏幕开始显示的,看起来有点尴尬。我希望让手表在屏幕中心显示输出。

$ watch -n 1 du -hs "*.part"

52K     Prince of Tennis Episode 100 English Subbed Online - Chia-Anime.mp4.part
64M     Prince of Tennis Episode 92 English Subbed Online - Chia-Anime.mp4.part
53M     Prince of Tennis Episode 93 English Subbed Online - Chia-Anime.mp4.part
23M     Prince of Tennis Episode 94 English Subbed Online - Chia-Anime.mp4.part
13M     Prince of Tennis Episode 95 English Subbed Online - Chia-Anime.mp4.part
24K     Prince of Tennis Episode 96 English Subbed Online - Chia-Anime.mp4.part
12K     Prince of Tennis Episode 97 English Subbed Online - Chia-Anime.mp4.part
40K     Prince of Tennis Episode 98 English Subbed Online - Chia-Anime.mp4.part
36K     Prince of Tennis Episode 99 English Subbed Online - Chia-Anime.mp4.part  

我希望这个输出从屏幕中心开始出现。

watch-command
  • 1 个回答
  • 82 Views
Martin Hope
devilz
Asked: 2017-04-15 07:33:01 +0800 CST

如何使用 fdisk 格式化 USB 驱动器?[复制]

  • -1
这个问题在这里已经有了答案:
格式化存储驱动器的终端方法 2答案
5年前关闭。

我想格式化 USB 驱动器 (/dev/sdc) 并使用 fdisk 创建多个不同类型的分区。我的 fdisk 使用扇区(不是柱面)来创建新分区。
/dev/sdc1 <- NTFS (10GiB)
/dev/sdc2 <- Fat32 (04GiB)

有人可以提供在终端中使用的分步方法吗?

http://oi67.tinypic.com/34h9v1z.jpg
http://oi68.tinypic.com/2954t5i.jpg

fdisk
  • 1 个回答
  • 1041 Views
Martin Hope
devilz
Asked: 2017-04-06 04:35:44 +0800 CST

如何使用 chroot 在 Ubuntu 中运行 Windows 07?

  • 0

有没有办法使用 chroot-jail 或 chroot 让任何 Windows-OS 在 Ubuntu 中运行?

编辑您认为有必要的问题,在此处输入 Windows 07 作为示例,并将其作为一个真正好的操作系统。

chroot
  • 1 个回答
  • 403 Views
Martin Hope
devilz
Asked: 2017-03-22 05:01:38 +0800 CST

如何更改内核以在 GRUB 中启动?

  • 3

我有内核 4.4.0-66-generic-tuxonice,想把它改成另一个 4.4.0-66-generic。

如何更改 grub 配置文件中的条目以执行此操作?我有:

SET GRUB_DEFAULT=0  

我相信我们也可以通过指定其名称来选择特定的内核?我不知道该怎么做...

原因是 4.4.0-66-generic 似乎比 TuxOnIce 更好地进行休眠,但它要求安装 TuxOnIce 文件。

linux-headers
  • 1 个回答
  • 6109 Views
Martin Hope
devilz
Asked: 2017-03-15 06:21:47 +0800 CST

如何在鱼壳中使用别名键入函数?

  • 0
# type repeat ;echo "this is a bash shell output"
repeat is a function
repeat () 
{ 
    local n i;
    n="$1";
    shift;
    for ((i = 1; i <= "$n"; ++i))
    do
        echo Date starting `date`;
        echo Before waiting `date`;
        sleep 6;
        echo Done waiting `date`;
        /usr/bin/mpv /usr/share/sounds/freedesktop/stereo/complete.oga;
        /usr/bin/mpv /usr/share/sounds/freedesktop/stereo/complete.oga;
        /usr/bin/mpv /usr/share/sounds/freedesktop/stereo/complete.oga;
        "$@";
    done
}

我想为鱼壳中的别名重复添加此功能。这个别名已经在 bash shell 中可用,但我也想在 fish shell 中使用它。# 表示它的root用户。对于普通用户,它的 Fish shell 已设置为默认值。

fish
  • 1 个回答
  • 270 Views
Martin Hope
devilz
Asked: 2017-03-02 02:58:21 +0800 CST

用户999安全吗?

  • 1

我不知道用户是如何更改为 999 的,也不知道它是否安全。

我系统中的一个文件夹将用户显示为 999,并且该文件夹内的其他文件和文件夹具有 root 权限。我尝试使用 chown 将文件夹权限更改为 root,但它不起作用。请让我知道如何将文件夹的权限更改为root。该文件夹不是系统文件夹,它更像是一个备份文件夹。

root@Gamers:~# chown -hR root /folder/name
root@Gamers:~# ls
drwsr-xr-x 4  999    1M Feb 25 21:25 /folder/name 
root@Gamers:~# grep '^\w*:\w*:999' /etc/passwd
root@Gamers:-#
permissions
  • 2 个回答
  • 14032 Views
Martin Hope
devilz
Asked: 2016-12-12 00:36:16 +0800 CST

使用重命名时如何排除具有特定数字的文件名

  • 1
$ dir  
Magi The Labyrinth Of Magic Episode 1 English Dubbed.mp4  
Magi The Labyrinth Of Magic Episode 2 English Dubbed.mp4  
Magi The Labyrinth Of Magic Episode 3 English Dubbed.mp4  
Magi The Labyrinth Of Magic Episode 4 English Dubbed.mp4  
Magi The Labyrinth Of Magic Episode 5 English Dubbed.mp4  
Magi The Labyrinth Of Magic Episode 6 English Dubbed.mp4  
Magi The Labyrinth Of Magic Episode 6 English Dubbed.mp4-1.part 

$ rename -n 's/Magi\ The\ Labyrinth\ Of\ Magic\ Episode\ {1..5}.+mp4/MTLOM\ \(DUB\)\ 0*{1..5}.mp4/g' *

Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/Magi\ The\ Labyrinth\ Of\ Magic\ Episode\ { <-- HERE 1..5}+mp4/ at (eval 1) line 1.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/Magi\ The\ Labyrinth\ Of\ Magic\ Episode\ { <-- HERE 1..5}+mp4/ at (eval 2) line 1.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/Magi\ The\ Labyrinth\ Of\ Magic\ Episode\ { <-- HERE 1..5}+mp4/ at (eval 3) line 1.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/Magi\ The\ Labyrinth\ Of\ Magic\ Episode\ { <-- HERE 1..5}+mp4/ at (eval 4) line 1.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/Magi\ The\ Labyrinth\ Of\ Magic\ Episode\ { <-- HERE 1..5}+mp4/ at (eval 5) line 1.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/Magi\ The\ Labyrinth\ Of\ Magic\ Episode\ { <-- HERE 1..5}+mp4/ at (eval 6) line 1.

我想重命名一些文件而不是其他文件;在 30 个文件中,要忽略的文件是第六个 6、16、8、28 和 19。

command-line
  • 1 个回答
  • 140 Views
Martin Hope
devilz
Asked: 2016-12-04 22:52:37 +0800 CST

为什么重复功能似乎不起作用?

  • -1
#function repeat   
repeat()  
{  
shift  
let b="$@"  
for i in {1..b} ; do echo Date starting `date` ; echo Before waiting `date`; sleep 6 ; echo Done waiting `date` ; "$@" ; done  
}  

我第一次尝试使用此功能时效果很好,然后在过去的几天里它工作了 2 次,然后它现在只工作了一次

$ repeat 7 ls

之前的输出显示 7 次,然后它只显示了两次,现在它只显示了一次输出。
请让我知道从第一天起就从未更改过的脚本中有什么错误。

command-line
  • 1 个回答
  • 65 Views
Martin Hope
devilz
Asked: 2016-11-20 01:08:15 +0800 CST

如何从文件名中删除数字?

  • 1

如何删除文件名中可用的数字?
在下面的示例中,您可以看到我想删除零

$ rename -n 's/Season\ (\d{2})\ Episode\ (\d{2}).+(\D{2})/Season\ $1\ Episode\ $2.mp4/' *

Season 01 Episode 01.mp4 renamed as Season 01 Episode 01.mp44  
Season 01 Episode 02.mp4 renamed as Season 01 Episode 02.mp44  
Season 01 Episode 03.mp4 renamed as Season 01 Episode 03.mp44  
Season 01 Episode 04.mp4 renamed as Season 01 Episode 04.mp44  
Season 01 Episode 05.mp4 renamed as Season 01 Episode 05.mp44  
Season 01 Episode 06.mp4 renamed as Season 01 Episode 06.mp44  
Season 01 Episode 07.mp4 renamed as Season 01 Episode 07.mp44  
Season 01 Episode 08.mp4 renamed as Season 01 Episode 08.mp44  
Season 01 Episode 09.mp4 renamed as Season 01 Episode 09.mp44  
Season 01 Episode 10.mp4 renamed as Season 01 Episode 10.mp44  
Season 01 Episode 11.mp4 renamed as Season 01 Episode 11.mp44  
Season 01 Episode 12.mp4 renamed as Season 01 Episode 12.mp44  
Season 01 Episode 13.mp4 renamed as Season 01 Episode 13.mp44  
Season 01 Episode 14.mp4 renamed as Season 01 Episode 14.mp44  
Season 01 Episode 15.mp4 renamed as Season 01 Episode 15.mp44  
Season 01 Episode 16.mp4 renamed as Season 01 Episode 16.mp44  
Season 01 Episode 17.mp4 renamed as Season 01 Episode 17.mp44  
Season 01 Episode 18.mp4 renamed as Season 01 Episode 18.mp44  
Season 01 Episode 19.mp4 renamed as Season 01 Episode 19.mp44  
Season 01 Episode 20.mp4 renamed as Season 01 Episode 20.mp44  
Season 01 Episode 21.mp4 renamed as Season 01 Episode 21.mp44  
Season 01 Episode 22.mp4 renamed as Season 01 Episode 22.mp44  
Season 01 Episode 23.mp4 renamed as Season 01 Episode 23.mp44  
Season 01 Episode 25.mp4 renamed as Season 01 Episode 25.mp44  
Season 01 Episode 26.mp4 renamed as Season 01 Episode 26.mp44  
Season 02 Episode 00.mp4 renamed as Season 02 Episode 00.mp44  
Season 02 Episode (this zero needs to be removed)***0***15.mp4 renamed as Season 02 Episode 01.mp44  
Season 02 Episode ***0***16.mp4 renamed as Season 02 Episode 01.mp44  
Season 02 Episode ***0***17.mp4 renamed as Season 02 Episode 01.mp44  
Season 02 Episode ***0***18.mp4 renamed as Season 02 Episode 01.mp44  
Season 02 Episode ***0***19.mp4 renamed as Season 02 Episode 01.mp44  
Season 02 Episode 01.mp4 renamed as Season 02 Episode 01.mp44  
Season 02 Episode ***0***20.mp4 renamed as Season 02 Episode 02.mp44  
Season 02 Episode ***0***21.mp4 renamed as Season 02 Episode 02.mp44  
Season 02 Episode 02.mp4 renamed as Season 02 Episode 02.mp44  
Season 02 Episode 03.mp4 renamed as Season 02 Episode 03.mp44  
Season 02 Episode 04.mp4 renamed as Season 02 Episode 04.mp44  
Season 02 Episode 05.mp4 renamed as Season 02 Episode 05.mp44  
Season 02 Episode 06.mp4 renamed as Season 02 Episode 06.mp44  
Season 02 Episode 07.mp4 renamed as Season 02 Episode 07.mp44  
Season 02 Episode 08.mp4 renamed as Season 02 Episode 08.mp44  
Season 02 Episode 09.mp4 renamed as Season 02 Episode 09.mp44  
Season 02 Episode 10.mp4 renamed as Season 02 Episode 10.mp44  
Season 02 Episode 11.mp4 renamed as Season 02 Episode 11.mp44  
Season 02 Episode 12.mp4 renamed as Season 02 Episode 12.mp44  
Season 02 Episode 13.mp4 renamed as Season 02 Episode 13.mp44  
Season 02 Episode 14.mp4 renamed as Season 02 Episode 14.mp44  

正如您所看到的,扩展名也没有正确重命名,使用 rename 命令。我也知道重命名命令是错误的,所以请提供正确的命令。

rename
  • 1 个回答
  • 139 Views
Martin Hope
devilz
Asked: 2016-09-29 10:48:46 +0800 CST

如何使用鱼壳删除文件夹中特定数量的文件?

  • 1
~/Desktop$ ls

file 01 file 02 file 03

file 04 file 05 file 06

file 07 file 08 file 09

file 10 file 101 file 102

好吧,列表一直这样持续到文件 109,然后它显示文件 10,然后显示文件 110,直到文件 119,然后是文件 11,然后是文件 120,直到文件 129,然后是文件 13,依此类推。

如何删除前 50 个文件(文件 01 到文件 50),文件总数为 138。

鱼壳也怎么做?
在提供的答案中,可以为 bash shell 完成。

command-line
  • 1 个回答
  • 303 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve