# Linuxコマンド（ターミナル）ティップス

**URL:** <https://forum.ficusonline.com/t/topic/311>\
**Category:** Linux\
**Created:** [2019 年 7 月 4 日午後 1:57 UTC](https://forum.ficusonline.com/t/topic/311 "2019-07-04T13:57:11Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)\
**Post date:** [2019 年 7 月 4 日午後 1:57 UTC](https://forum.ficusonline.com/t/topic/311/1 "2019-07-04T13:57:11Z")

</div>

Linuxコマンドの使い方などの要約は **`GitHub`** のトピックスに多く投稿されています。  
以下 **`linux-command-line`** というキーワードのトピックの一例です。

[https://github.com/topics/linux-command-line](https://github.com/topics/linux-command-line)

> **[GitHub - shreyaschavhan/linux-commands-cheatsheet: All Useful Linux Commands (For OSCP & daily...](https://github.com/shreyaschavhan/linux-commands-cheatsheet)**
>
> All Useful Linux Commands (For OSCP & daily pen-testing usage)

### dpkg

ビルドしたdebianパッケージをインストールする際などに使用。

> <https://askubuntu.com/questions/40779/how-do-i-install-a-deb-file-via-the-command-line>

### Install a package

```auto
$ sudo dpkg -i DEB_PACKAGE

```

### Remove a package

```auto
$ sudo dpkg -r PACKAGE_NAME

```

> <https://askubuntu.com/questions/423355/how-do-i-check-if-a-package-is-installed-on-my-server>

> **[15 dpkg commands to Manage Debian based Linux Servers](https://www.linuxsysadmins.com/15-dpkg-commands-in-linux-servers/)**
>
> dpkg is the package manager for Debian based Linux servers. We can manage an installed package in Ubuntu/Debian Linux server by using dpkg command.

---

<div class="post-metadata">

**Author:** ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)\
**Post date:** [2020 年 3 月 11 日午前 2:43 UTC](https://forum.ficusonline.com/t/topic/311/2 "2020-03-11T02:43:45Z")

</div>

### rpm2cpio / cpio

rpmパッケージからの中身抽出

> <https://stackoverflow.com/questions/18787375/how-do-i-extract-the-contents-of-an-rpm>

Ex)

```auto
$ rpm2cpio systemd-rpm-macros-245-1.fc33.noarch.rpm | cpio -idmv
./usr/lib/rpm/fileattrs
./usr/lib/rpm/fileattrs/sysusers.attr
./usr/lib/rpm/macros.d/macros.systemd
./usr/lib/rpm/macros.d/macros.sysusers
./usr/lib/rpm/sysusers.generate-pre.sh
./usr/lib/rpm/sysusers.prov

```

---

<div class="post-metadata">

**Author:** ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)\
**Post date:** [2021 年 1 月 7 日午前 2:19 UTC](https://forum.ficusonline.com/t/topic/311/3 "2021-01-07T02:19:23Z")

</div>

ターミナルのロケールを日本語から英語に変更。

> <https://askubuntu.com/questions/673741/how-to-change-language-only-for-terminal>

ホームディレクトリの `~/.bashrc`ファイルに以下を追加します。

```auto
export LANG=C

```

ロケールの確認

```auto
$ locale
LANG=C
LANGUAGE=ja:en
LC_CTYPE="C"
LC_NUMERIC=ja_JP.UTF-8
LC_TIME=ja_JP.UTF-8
LC_COLLATE="C"
LC_MONETARY=ja_JP.UTF-8
LC_MESSAGES="C"
LC_PAPER=ja_JP.UTF-8
LC_NAME=ja_JP.UTF-8
LC_ADDRESS=ja_JP.UTF-8
LC_TELEPHONE=ja_JP.UTF-8
LC_MEASUREMENT=ja_JP.UTF-8
LC_IDENTIFICATION=ja_JP.UTF-8
LC_ALL=

```

または`LANG=C`を指定してコマンド実行

```auto
$ LANG=C sudo apt update
$ LANG=C sudo apt upgrade

```

日本語でのディレクトリ表記などが文字化けするので、日本語表記が必要な場合は、コマンド前に`LANG=ja_JP.UTF-8`を追加すること。  
_ex)_

```auto
$ LANG=ja_JP.UTF-8 sudo apt update
or
$ LANG=ja_JP.utf8 sudo apt update

```

---

<div class="post-metadata">

**Author:** ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)\
**Post date:** [2021 年 1 月 7 日午前 2:19 UTC](https://forum.ficusonline.com/t/topic/311/4 "2021-01-07T02:19:48Z")

</div>

> **[Boost Up Productivity in Bash - Tips and Tricks | Linux Journal](https://www.linuxjournal.com/content/boost-productivity-bash-tips-and-tricks)**

ターミナルによるQRコード生成

```auto
$ printf "https://ficus.myvnc.com" | curl -F-=\<- qrenco.de

```

 ![ficusonline-qrcode](https://forum.ficusonline.com/uploads/default/original/1X/c3345d090fad27101b0460847b4bc9669e0b7b7e.png)

---

<div class="post-metadata">

**Author:** ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)\
**Post date:** [2021 年 1 月 7 日午前 2:37 UTC](https://forum.ficusonline.com/t/topic/311/5 "2021-01-07T02:37:52Z")

</div>

### /dev/urandomファイルによる乱数生成（抽出）

> **[Myths about /dev/urandom](https://www.2uo.de/myths-about-urandom/)**

> **[/dev/random](https://en.wikipedia.org/wiki//dev/random)**
>
> In Unix-like operating systems, /dev/random and /dev/urandom are special files that provide random numbers from a cryptographically secure pseudorandom number generator (CSPRNG). The CSPRNG is seeded with entropy (a value that provides randomness) from environmental noise, collected from device drivers and other sources. Users can obtain random numbers from the CSPRNG simply by reading the file. Not all operating systems implement the same methods for /dev/random and /dev/urandom.
> In older opera...

**head, trコマンドとの組合せにより乱数生成（抽出）**

**文字列レンジ指定：A-Z,a-z,0-9 文字数40**

```auto
$ RAMDOM_1=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 40)
$ echo $RANDOM_1
l3DX4F3yh5ZxvQt5AGE9ndiYxvfUlJvpXY2NrTkJ

```

**文字列レンジ指定：a-f,0-9 文字数128**

```auto
$ RANDOM_2=$(head /dev/urandom | tr -dc a-f0-9 | head -c 128)
$ echo $RANDOM_2
92169f319761ab50531e07ad814c193f4e5af5c8e247dc82918927e718b69c3796d943ff2707e91de20b67cd95b130e35972f5f488843744384c98e1d29eae83

```

---

<div class="post-metadata">

**Author:** ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)\
**Post date:** [2021 年 1 月 17 日午後 12:43 UTC](https://forum.ficusonline.com/t/topic/311/6 "2021-01-17T12:43:55Z")

</div>

### crontab

起動アプリ・シェルコマンドのスケジュール設定

> **[crontab(5) - Linux manual page](https://man7.org/linux/man-pages/man5/crontab.5.html)**

```auto
$ sudo crontab -e
       # use /bin/sh to run commands, no matter what /etc/passwd says
       SHELL=/bin/sh
       # mail any output to `paul', no matter whose crontab this is
       MAILTO=paul
       #
       CRON_TZ=Japan
       # run five minutes after midnight, every day
       5 0 * * * $HOME/bin/daily.job >> $HOME/tmp/out 2>&1
       # run at 2:15pm on the first of every month -- output mailed to paul
       15 14 1 * * $HOME/bin/monthly
       # run at 10 pm on weekdays, annoy Joe
       0 22 * * 1-5 mail -s "It's 10pm" joe%Joe,%%Where are your kids?%
       23 0-23/2 * * * echo "run 23 minutes after midn, 2am, 4am ..., everyday"
       5 4 * * sun echo "run at 5 after 4 every sunday"

```

以下5つの **field** によりスケジュールを設定

> ```
> field allowed values
> ----- --------------
> minute 0-59
> hour 0-23
> day of month 1-31
> month 1-12 (or names, see below)
> day of week 0-7 (0 or 7 is Sunday, or use names)
> 
> ```

- **/etc/crontab** : メインシステムの **crontab** ファイル
- **/var/spool/cron/** : **root** を含むユーザ定義の **crontab** ファイル格納ディレクトリ（`$ sudo crontab -e`）
- **/etc/cron.d/** : 導入アプリなどの **crontab** ファイル格納ディレクトリ

以下5つのフィールドではなく **@** 表記によるスケジュール設定

> ```
> @reboot : Run once after reboot.
> @yearly : Run once a year, ie. "0 0 1 1 *".
> @annually : Run once a year, ie. "0 0 1 1 *".
> @monthly : Run once a month, ie. "0 0 1 * *".
> @weekly : Run once a week, ie. "0 0 * * 0".
> @daily : Run once a day, ie. "0 0 * * *".
> @hourly : Run once an hour, ie. "0 * * * *".
> 
> ```

#### コマンドの書出し

```auto
$ sudo crontab -l | grep KEY_WORD

```

---

<div class="post-metadata">

**Author:** ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)\
**Post date:** [2021 年 2 月 1 日午前 12:44 UTC](https://forum.ficusonline.com/t/topic/311/7 "2021-02-01T00:44:09Z")

</div>

### ネットワークソケットの確認コマンド

### ss(簡易)

> **[12 ss Command Examples to Monitor Network Connections](https://www.tecmint.com/ss-command-examples-in-linux/)**
>
> In this guide, we delve in and see how the ss command can be used to display varied network socket connection information in Linux with examples.

**ex)**

```auto
$ sudo ss -tlpen | grep 7443

```

### netstat（詳細）

> **[20 Netstat Commands for Linux Network Management](https://www.tecmint.com/20-netstat-commands-for-linux-network-management/)**
>
> netstat (network statistics) is a command-line tool for monitoring network connections both incoming and outgoing as well as viewing routing tables, interface statistics, etc.

**ex)**

```auto
$ sudo netstat -tupln | grep -e freeswitch -e 7443

```

---

<div class="post-metadata">

**Author:** ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)\
**Post date:** [2021 年 2 月 21 日午前 12:49 UTC](https://forum.ficusonline.com/t/topic/311/8 "2021-02-21T00:49:12Z")

</div>

### Sed .\*

> **[sed, a stream editor](https://www.gnu.org/software/sed/manual/sed.html)**
>
> sed, a stream editor

> <https://stackoverflow.com/questions/16440377/replace-whole-line-when-match-found-with-sed>

```auto
$ cat file
six
asdf
one two six
one isix
boo
$ sed 's/.*six.*/fault/' file
fault
asdf
fault
fault
boo

```

変数挿入

> <https://askubuntu.com/questions/76808/how-do-i-use-variables-in-a-sed-command>

### Using double quotes

Use double quotes to make the shell expand variables while preserving whitespace:

```auto
$ var1=$(cat test.txt)
$ sudo sed -i "s/$var1/ZZ/g" "$file"

```

変数に `/` が含まれている場合は、`|` を使用（他にもdelimiterとして `+,#` などでも可）。

```auto
$ sudo sed -i "s|$var|r_str|g" file_name

```

> <https://stackoverflow.com/questions/5864146/using-different-delimiters-in-sed-commands-and-range-addresses>

同一ディレクトリ内の\*cファイル全てにテキストの置換えをする場合

```auto
$ sudo find /home/user/directory -name \*.c -exec sed -i "s/cybernetnews/cybernet/g" {} \;

```

> <https://askubuntu.com/questions/84007/find-and-replace-text-within-multiple-files>

---

<div class="post-metadata">

**Author:** ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)\
**Post date:** [2021 年 7 月 1 日午後 3:08 UTC](https://forum.ficusonline.com/t/topic/311/10 "2021-07-01T15:08:15Z")

</div>

### apt upgrade エラー

```auto
$ sudo apt upgrade
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています                
状態情報を読み取っています... 完了
アップグレードパッケージを検出しています... 完了
以下のパッケージはアップグレードされます:
  firefox firefox-locale-en firefox-locale-ja firefox-locale-zh-hans google-cloud-sdk
アップグレード: 5 個、新規インストール: 0 個、削除: 0 個、保留: 0 個。
4 standard security updates
129 MB 中 0 B のアーカイブを取得する必要があります。
この操作後に追加で 1,112 kB のディスク容量が消費されます。
続行しますか? [Y/n] 
dpkg: unrecoverable fatal error, aborting:
 パッケージ 'rsync' のファイル一覧ファイルに最後の改行がありません
E: Sub-process /usr/bin/dpkg returned an error code (2)

```

日本語での情報は皆無なので、`LANG=C` オプションを付けて英語表記にしてエラー内容を表示・検索。

```auto
$ LANG=C sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  firefox firefox-locale-en firefox-locale-ja firefox-locale-zh-hans google-cloud-sdk
5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
4 standard security updates
Need to get 0 B/129 MB of archives.
After this operation, 1,112 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
dpkg: unrecoverable fatal error, aborting:
 files list file for package 'rsync' is missing final newline
E: Sub-process /usr/bin/dpkg returned an error code (2)

```

以下参照

> <https://askubuntu.com/questions/909719/dpkg-unrecoverable-fatal-error-aborting-files-list-file-for-package-linux-ge>

```shell
$ cd /var/lib/dpkg/info
$ sudo rm -f *.postrm *.list

$ sudo dpkg --configure -a
$ sudo apt update
$ sudo apt upgrade

```

---

<div class="post-metadata">

**Author:** ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)\
**Post date:** [2021 年 7 月 6 日午後 2:40 UTC](https://forum.ficusonline.com/t/topic/311/11 "2021-07-06T14:40:08Z")

</div>

## About iw

> **[About iw — Linux Wireless documentation](https://wireless.docs.kernel.org/en/latest/en/users/documentation/iw.html)**

**Getting station statistics**  
To get station statistic information such as the amount of tx/rx bytes, the last TX bitrate (including MCS rate) you can do:

```auto
$ sudo iw dev wlan1 station dump
Station 12:34:56:78:9a:bc (on wlan0)
        inactive time: 304 ms
        rx bytes: 18816
        rx packets: 75
        tx bytes: 5386
        tx packets: 21
        signal: -29 dBm
        tx bitrate: 54.0 MBit/s

```

---

<div class="post-metadata">

**Author:** ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)\
**Post date:** [2022 年 3 月 16 日午前 12:05 UTC](https://forum.ficusonline.com/t/topic/311/12 "2022-03-16T00:05:53Z")

</div>

### find (File Permissions)

[https://linuxize.com/post/chmod-command-in-linux/](https://linuxize.com/post/chmod-command-in-linux/)

```auto
# find /var/www/my_website -type d -exec chmod 755 {} \;
# find /var/www/my_website -type f -exec chmod 644 {} \;

```

or

```auto
# find /var/www/my_website -type d -exec chmod u=rwx,go=rx {} \;
# find /var/www/my_website -type f -exec chmod u=rw,go=r {} \;

```

> <https://askubuntu.com/questions/339015/what-does-mean-in-the-find-command>

---

<div class="post-metadata">

**Author:** ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)\
**Post date:** [2022 年 5 月 19 日午前 11:27 UTC](https://forum.ficusonline.com/t/topic/311/13 "2022-05-19T11:27:26Z")

</div>

## How to append multiple lines to a file

> <https://unix.stackexchange.com/questions/77277/how-to-append-multiple-lines-to-a-file>

```auto
# possibility 1:
echo "line 1" >> greetings.txt
echo "line 2" >> greetings.txt

# possibility 2:
echo "line 1
line 2" >> greetings.txt

# possibility 3:
cat <<EOT >> greetings.txt
line 1
line 2
EOT

```

If sudo (other user privileges) is needed to write to the file, use this:

```auto
# possibility 1:
echo "line 1" | sudo tee -a greetings.txt > /dev/null

# possibility 3:
sudo tee -a greetings.txt > /dev/null <<EOT
line 1
line 2
EOT

```

---

<div class="post-metadata">

**Author:** ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)\
**Post date:** [2022 年 5 月 30 日午前 2:25 UTC](https://forum.ficusonline.com/t/topic/311/14 "2022-05-30T02:25:12Z")

</div>

## 変数定義上の注意点

> <https://stackoverflow.com/questions/40192725/bash-script-store-cat-output-in-variable-and-then-echo-it>

> <https://stackoverflow.com/questions/2268104/command-not-found-error-in-bash-variable-assignment>

```auto
#!/bin/bash

var = $(cat tmp/pids/unicorn.pid)

echo $var
sudo kill -QUIT $var

```

イコール前後のスペースは削除すること。  
`誤 ---> var = $(cat tmp/pids/unicorn.pid)`  
**`正 ---> var=$(cat tmp/pids/unicorn.pid)`**

---

<div class="post-metadata">

**Author:** ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)\
**Post date:** [2022 年 6 月 9 日午前 3:08 UTC](https://forum.ficusonline.com/t/topic/311/15 "2022-06-09T03:08:23Z")

</div>

### バックグラウンドプロセスの起動と停止

`&` を追加してバックグラウンドで起動

```auto
$ sudo ./wireguard-ui &

```

バックグラウンドのジョブ確認

```auto
$ jobs -l
[1]+ 63800 Running sudo ./wireguard-ui &

```

上記プロセス `ID1` をフォアグラウンドで表示

```auto
$ fg %1

```

フォアグラウンドに表示されたプロセスを`Ctl+c`で停止

---

<div class="post-metadata">

**Author:** ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)\
**Post date:** [2022 年 7 月 18 日午後 3:01 UTC](https://forum.ficusonline.com/t/topic/311/16 "2022-07-18T15:01:20Z")

</div>

## lsblk : ブロックデバイスの一覧表示（ハードディスク等）

[https://manpages.ubuntu.com/manpages/jammy/ja/man8/lsblk.8.html](https://manpages.ubuntu.com/manpages/jammy/ja/man8/lsblk.8.html)

> <https://askubuntu.com/questions/1327869/my-ubuntu-vg-ubuntu-lv-out-of-disk-space>

```auto
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 32.3M 1 loop /snap/snapd/11402
loop1 7:1 0 61.6M 1 loop /snap/core20/904
loop2 7:2 0 348K 1 loop /snap/bpytop/216
sr0 11:0 1 841M 0 rom
vda 252:0 0 250G 0 disk
├─vda1 252:1 0 1M 0 part
├─vda2 252:2 0 1G 0 part /boot
└─vda3 252:3 0 49G 0 part
  └─ubuntu--vg-ubuntu--lv 253:0 0 49G 0 lvm /

```

---

<div class="post-metadata">

**Author:** ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)\
**Post date:** [2022 年 9 月 11 日午前 1:54 UTC](https://forum.ficusonline.com/t/topic/311/17 "2022-09-11T01:54:35Z")

</div>

> <https://askubuntu.com/questions/410244/is-there-a-command-to-list-all-users-also-to-add-delete-modify-users-in-the>

### To list

To list all _ **local** _ users you can use:

```auto
$ cut -d: -f1 /etc/passwd

```

To list all users capable of authenticating (in some way), including non-local, see [this reply](https://askubuntu.com/a/414561/571941).

Some more useful user-management commands (also limited to _ **local** _ users):

### To add

To add a new user you can use:

```auto
$ sudo adduser new_username

```

or:

```auto
$ sudo useradd new_username

```

See also: [What is the difference between adduser and useradd?](https://askubuntu.com/q/345974/147044)

### To remove/delete

To remove/delete a user, first you can use:

```auto
$ sudo userdel username

```

Then you may want to delete the home directory for the deleted user account :

$ sudo rm -r /home/_username_

Please use with caution the above command!

### To modify

To modify the username of a user:

```auto
$ usermod -l new_username old_username

```

To change the password for a user:

```auto
$ sudo passwd username

```

To change the shell for a user:

```auto
$ sudo chsh username

```

To change the details for a user (for example real name):

```auto
$ sudo chfn username

```

To add a user to the `sudo` group:

```auto
$ adduser username sudo

```

or

```auto
$ usermod -aG sudo username

```

> <https://askubuntu.com/questions/345974/what-is-the-difference-between-adduser-and-useradd>

---

<div class="post-metadata">

**Author:** ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)\
**Post date:** [2022 年 10 月 7 日午前 5:31 UTC](https://forum.ficusonline.com/t/topic/311/18 "2022-10-07T05:31:21Z")

</div>

## ctrl c vs. ctrl z with foreground job

> <https://unix.stackexchange.com/questions/135077/ctrl-c-vs-ctrl-z-with-foreground-job>

```auto
z@z-lap:~$ sleep 100&
[1] 4458
z@z-lap:~$ sleep 200&
[2] 4459
z@z-lap:~$ jobs
[1]- Running sleep 100 &
[2]+ Running sleep 200 &
z@z-lap:~$ fg %1
sleep 100
^Z
[1]+ Stopped sleep 100
z@z-lap:~$ jobs
[1]+ Stopped sleep 100
[2]- Running sleep 200 &
z@z-lap:~$ fg %1
sleep 100
^C
z@z-lap:~$ jobs
[2]+ Running sleep 200 &

```

---

<div class="post-metadata">

**Author:** ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)\
**Post date:** [2023 年 6 月 13 日午前 2:55 UTC](https://forum.ficusonline.com/t/topic/311/19 "2023-06-13T02:55:55Z")

</div>

## grepコマンドによるワード抽出

grepコマンドでダウンロードしたxmlファイルからURLのみを抽出し、新たなファイルとして保存します。

```auto
$ wget https://www.nhk.or.jp/radio/config/config_web.xml
$ grep -Eo "https?://\S+?\.m3u8" config_web.xml > nhk.m3u

```

> <https://stackoverflow.com/questions/32616582/extract-all-urls-that-start-with-http-or-https-and-end-with-html-from-text-file>

---

<div class="post-metadata">

**Author:** ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)\
**Post date:** [2023 年 7 月 31 日午後 1:11 UTC](https://forum.ficusonline.com/t/topic/311/20 "2023-07-31T13:11:04Z")

</div>

## PC Hardware Check

[https://forums.linuxmint.com/viewtopic.php?t=295663](https://forums.linuxmint.com/viewtopic.php?t=295663)

```auto
$ sudo apt install inxi
$ inxi -Fxz
System:
  Kernel: 5.19.0-50-generic x86_64 bits: 64 compiler: N/A Desktop: GNOME 42.9
    Distro: Ubuntu 22.04.2 LTS (Jammy Jellyfish)
Machine:
  Type: Laptop System: HP product: HP Notebook v: Type1ProductConfigId
    serial: <superuser required>
  Mobo: HP model: 80C1 v: 96.53 serial: <superuser required> UEFI: Insyde
    v: F.29 date: 05/24/2019
Battery:
  ID-1: BAT1 charge: 0% condition: 34.5/41.4 Wh (83.1%) volts: 3.7 min: 14.8
    model: COMPAL PABAS0241231 status: Not charging
  Device-1: hidpp_battery_0 model: Logitech Wireless Mouse M325
    charge: 55% (should be ignored) status: Discharging
CPU:
  Info: dual core model: Intel Core i5-5200U bits: 64 type: MT MCP
    arch: Broadwell rev: 4 cache: L1: 128 KiB L2: 512 KiB L3: 3 MiB
  Speed (MHz): avg: 2183 high: 2190 min/max: 500/2700 cores: 1: 2176
    2: 2179 3: 2190 4: 2189 bogomips: 17557
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3
Graphics:
  Device-1: Intel HD Graphics 5500 vendor: Hewlett-Packard driver: i915
    v: kernel bus-ID: 00:02.0
  Device-2: Chicony HP Truevision HD type: USB driver: uvcvideo
    bus-ID: 1-5:5
  Display: wayland server: X.Org v: 1.22.1.1 with: Xwayland v: 22.1.1
    compositor: gnome-shell driver: gpu: i915 resolution: 1: 1440x900~60Hz
    2: 1920x1080~60Hz
  OpenGL: renderer: Mesa Intel HD Graphics 5500 (BDW GT2)
    v: 4.6 Mesa 22.2.5-0ubuntu0.1~22.04.3 direct render: Yes
Audio:
  Device-1: Intel Broadwell-U Audio vendor: Hewlett-Packard
    driver: snd_hda_intel v: kernel bus-ID: 00:03.0
  Device-2: Intel Wildcat Point-LP High Definition Audio
    vendor: Hewlett-Packard driver: snd_hda_intel v: kernel bus-ID: 00:1b.0
  Sound Server-1: ALSA v: k5.19.0-50-generic running: yes
  Sound Server-2: PulseAudio v: 15.99.1 running: yes
  Sound Server-3: PipeWire v: 0.3.48 running: yes
Network:
  Device-1: Realtek RTL810xE PCI Express Fast Ethernet
    vendor: Hewlett-Packard driver: r8169 v: kernel port: 4000 bus-ID: 07:00.0
  IF: enp7s0 state: down mac: <filter>
  Device-2: Realtek RTL8723BE PCIe Wireless Network Adapter
    vendor: Hewlett-Packard driver: rtl8723be v: kernel port: 3000
    bus-ID: 0d:00.0
  IF: wlp13s0 state: up mac: <filter>
  IF-ID-1: br-3f36f98beadb state: down mac: <filter>
  IF-ID-2: br-7a5354842f34 state: down mac: <filter>
  IF-ID-3: docker0 state: down mac: <filter>
  IF-ID-4: f9e state: unknown speed: N/A duplex: N/A mac: N/A
Bluetooth:
  Device-1: Realtek Bluetooth Radio type: USB driver: btusb v: 0.8
    bus-ID: 1-4:4
  Report: hciconfig ID: hci0 rfk-id: 8 state: down
    bt-service: enabled,running rfk-block: hardware: no software: yes
    address: <filter>
Drives:
  Local Storage: total: 476.94 GiB used: 143.54 GiB (30.1%)
  ID-1: /dev/sda model: AS-512 size: 476.94 GiB
Partition:
  ID-1: / size: 467.89 GiB used: 143.53 GiB (30.7%) fs: ext4 dev: /dev/sda2
  ID-2: /boot/efi size: 511 MiB used: 6.1 MiB (1.2%) fs: vfat
    dev: /dev/sda1
Swap:
  ID-1: swap-1 type: file size: 2 GiB used: 0 KiB (0.0%) file: /swapfile
Sensors:
  System Temperatures: cpu: 55.0 C pch: 47.0 C mobo: N/A
  Fan Speeds (RPM): N/A
Info:
  Processes: 248 Uptime: 1d 5h 0m Memory: 11.59 GiB used: 2.55 GiB (22.0%)
  Init: systemd runlevel: 5 Compilers: gcc: 11.3.0 Packages: 2152 Shell: Bash
  v: 5.1.16 inxi: 3.3.13

```
