$ ps -u | grep bash 👇 ここ koichi 2925430 0.0 0.0 10804 6040 pts/7 Ss 20:31 0:02 -bash koichi 2970810 0.0 0.0 8824 5568 pts/23 Ss 20:35 0:00 -bash koichi 3061064 0.0 0.0 8688 4204 pts/22 Ss 21:11 0:00 -bash koichi 3309961 0.0 0.0 8820 5832 pts/0 Ss 22:03 0:00 -bash というような問題を解くのが嫌になったので、hdr コマンドを作りました。コマンドの前に hdr と書くだけでヘッダ行を残すことができます。 $ ps -u | hdr grep bash 👇 ここ USER PID %CPU %MEM VSZ RSS TTY STAT
![grep・sort時にヘッダ行(一行目)を残すhdrコマンドを作ったよ - Qiita](https://cdn-ak-scissors.b.st-hatena.com/image/square/b31a6ad92632cd923778ca176782f3d78de4a8f7/height=288;version=1;width=512/https%3A%2F%2Fqiita-user-contents.imgix.net%2Fhttps%253A%252F%252Fcdn.qiita.com%252Fassets%252Fpublic%252Farticle-ogp-background-9f5428127621718a910c8b63951390ad.png%3Fixlib%3Drb-4.0.0%26w%3D1200%26mark64%3DaHR0cHM6Ly9xaWl0YS11c2VyLWNvbnRlbnRzLmltZ2l4Lm5ldC9-dGV4dD9peGxpYj1yYi00LjAuMCZ3PTkxNiZoPTMzNiZ0eHQ9Z3JlcCVFMyU4MyVCQnNvcnQlRTYlOTklODIlRTMlODElQUIlRTMlODMlOTglRTMlODMlODMlRTMlODMlODAlRTglQTElOEMlRUYlQkMlODglRTQlQjglODAlRTglQTElOEMlRTclOUIlQUUlRUYlQkMlODklRTMlODIlOTIlRTYlQUUlOEIlRTMlODElOTloZHIlRTMlODIlQjMlRTMlODMlOUUlRTMlODMlQjMlRTMlODMlODklRTMlODIlOTIlRTQlQkQlOUMlRTMlODElQTMlRTMlODElOUYlRTMlODIlODgmdHh0LWNvbG9yPSUyMzIxMjEyMSZ0eHQtZm9udD1IaXJhZ2lubyUyMFNhbnMlMjBXNiZ0eHQtc2l6ZT01NiZ0eHQtY2xpcD1lbGxpcHNpcyZ0eHQtYWxpZ249bGVmdCUyQ3RvcCZzPTRkYmYzM2YzNjFlMzQxYWViODBhYjU2OTIyNDYxOTk3%26mark-x%3D142%26mark-y%3D112%26blend64%3DaHR0cHM6Ly9xaWl0YS11c2VyLWNvbnRlbnRzLmltZ2l4Lm5ldC9-dGV4dD9peGxpYj1yYi00LjAuMCZ3PTYxNiZ0eHQ9JTQwa28xbmtzbSZ0eHQtY29sb3I9JTIzMjEyMTIxJnR4dC1mb250PUhpcmFnaW5vJTIwU2FucyUyMFc2JnR4dC1zaXplPTM2JnR4dC1hbGlnbj1sZWZ0JTJDdG9wJnM9M2NmYjZkZGZmZTg2YzU2N2U1NzI1ZmZlZjQ3MjkxYzE%26blend-x%3D142%26blend-y%3D491%26blend-mode%3Dnormal%26s%3D875498faca7b6b09b39bd500a31d618a)