현재 터미널 이름을 얻는 방법? START

현재 터미널 이름을 어떻게 가져 옵니까?

psTTY 열에 표시 되는 이름을 의미합니다. 예 :

root@dor-desktop:/home/dor/Documents/LAMP_setup/webs_install/do/install# ps aux | egrep 'mysql|(^USER)'
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
dor       2238  0.2  1.9 448052 79796 ?        S    17:27   0:17 gedit /home/dor/Documents/LAMP_setup/webs_install/do/install/mysql.install /home/dor/Documents/LAMP_setup/webs_install/do/install/mysql.setup
root      4975  0.1  0.5 324984 22876 ?        S    18:12   0:04 gedit /usr/local/mysql/bin/mysqld_safe
root      8160  0.0  0.0   4108   664 pts/2    S    19:08   0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --skip-networking --skip-grant-tables --user=mysql --basedir=/usr/local/mysql --ledir=/usr/local/mysql/libexec
mysql     8279  0.0  0.4 146552 19032 pts/2    Sl   19:08   0:00 /usr/local/mysql/libexec/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var --user=mysql --skip-networking --skip-grant-tables --log-error=/usr/local/mysql/var/dor-desktop.err --pid-file=/usr/local/mysql/var/dor-desktop.pid --socket=/usr/local/mysql/mysql.sock --port=3306
root      8342  0.0  0.0   7632  1024 pts/2    R+   19:14   0:00 egrep --color=auto mysql|(^USER)

위의 예에서, pts/2아마도 해당 명령을 실행 한 현재 터미널의 이름 인 페치를 가져와야 합니다.



답변

tty

이제 3이 충분했을 때 30자를 입력해야합니다 … 🙂


답변

Re : “그 명령이 무엇인지, 무엇을하는지, 명령으로 무엇을 할 수 있는지에 대해 간단히 설명 할 수 있습니다. 더 나은 답변이 될 것입니다. – Bobby”

현재 터미널의 유닉스 이름 (혹은 우리가 이전에 사용했던 콘솔이 때때로 호출하기 위해 사용하는 콘솔)은 다음과 같습니다. / dev / tty는 명령 프롬프트에서 새로운 여러 줄 파일을 쉽게 만들 수 있습니다. cp / dev / tty README.md (그러면 텍스트를 입력하고 다시 입력하고 두 번째 줄을 입력 할 수있는 새로운 빈 줄에 커서를 놓습니다. 줄 입력을 마치면 control-d를 수행하면 cp 명령이 종료됩니다. 그리고 당신은 단일 명령으로 여러 줄 파일을 만들 것입니다).