Useful Commands: Difference between revisions

From Fundamental Ramen
Jump to navigation Jump to search
Line 49: Line 49:
echo $PATH | tr ':' '\n'
echo $PATH | tr ':' '\n'
echo $PATH | tr ':' '\n' | grep 'snap'
echo $PATH | tr ':' '\n' | grep 'snap'
</syntaxhighlight>
|}
= File System =
{| class="wikitable"
! Purpose || Command
|-
| list with color and suffix for dir and link
| <syntaxhighlight lang="bash">ls -FG</syntaxhighlight>
|-
| list add hidden files only '''single quote is necessary'''
| <syntaxhighlight lang="bash">find . -name '.*'</syntaxhighlight>
|-
| delete dist directory recursively except README.md and itself.
| <syntaxhighlight lang="bash">
find ../../assets/swagger/support ! -path *swagger/support ! -name 'README.md' -delete
</syntaxhighlight>
|-
| delete files that filename leads by - or --
| <syntaxhighlight lang="bash">rm -- -X --exclude-from</syntaxhighlight>
|-
| Set file mtime <br/>2013-09-01 00:00:00
| <syntaxhighlight lang="bash">touch -t 201309010000 FILENAME</syntaxhighlight>
|-
| create ramdisk for Linux (cannot set size)
| <syntaxhighlight lang="bash">mount -t ramfs ramfs /usr/local/ramdisk</syntaxhighlight>
|-
| create ramdisk for Linux/BSD
| <syntaxhighlight lang="bash">mount -t tmpfs -o size=128m tmpfs /usr/local/ramdisk</syntaxhighlight>
|-
| Test I/O performance of 1G write with 4K block
| <syntaxhighlight lang="bash">dd if=/dev/zero of=100k.bin bs=4k count=262144</syntaxhighlight>
|-
| Create file with 100K size
| <syntaxhighlight lang="bash">dd if=/dev/zero of=100k.bin bs=1k count=100</syntaxhighlight>
|-
| Create file with 1M size<br/>No warning on disk full
| <syntaxhighlight lang="bash">dd if=/dev/zero of=10m.bin bs=1m count=10</syntaxhighlight>
|-
| Simulate memory consumption (RAM+SWAP)
| <syntaxhighlight lang="bash">
mkdir /usr/local/ramdisk
mount -t tmpfs -o size=2G tmpfs /usr/local/ramdisk
dd if=/dev/zero of=/usr/local/ramdisk/fill.bin bs=1m count=2048
</syntaxhighlight>
</syntaxhighlight>
|}
|}

Revision as of 01:39, 17 September 2026

https://www.diskpart.com/articles/delete-hidden-partition-on-usb-drive-7201.html

Overview

Services Networking OS Hardware Packages File System Data

Trouble shooting

Purpose Command
Verify $PATH by line.
echo $PATH | tr ':' '\n'
echo $PATH | tr ':' '\n' | grep 'snap'