{"id":836,"date":"2010-11-24T18:27:00","date_gmt":"2010-11-24T18:27:00","guid":{"rendered":"http:\/\/it4bus.vn\/itersdesktop\/2010\/11\/24\/tips-tricks-with-the-terminal-in-ubuntu-phan-1\/"},"modified":"2020-04-23T07:31:22","modified_gmt":"2020-04-23T06:31:22","slug":"tips-tricks-with-the-terminal-in-ubuntu-phan-1","status":"publish","type":"post","link":"https:\/\/www.itersdesktop.com\/fr\/2010\/11\/24\/tips-tricks-with-the-terminal-in-ubuntu-phan-1\/","title":{"rendered":"Tips tricks with the terminal in Ubuntu [Ph\u1ea7n 1]"},"content":{"rendered":"<div dir=\"ltr\" trbidi=\"on\">\n<b>In \u1ea5n<\/b><br \/>L\u1ec7nh lpr l\u00e0 s\u1eed d\u1ee5ng \u0111\u1ec3 in t\u00e0i li\u1ec7u trong m\u00f4i tr\u01b0\u1eddng Linux do g\u00f3i CUPS cung c\u1ea5p. <a href=\"http:\/\/www.cups.org\/doc-1.1\/sum.html\">\u0110\u00e2y<\/a> l\u00e0 to\u00e0n b\u1ed9 h\u01b0\u1edbng d\u1eabn. B\u00ean d\u01b0\u1edbi ch\u1ec9 t\u00f3m t\u1eaft c\u00e1c l\u1ec7nh ph\u1ed5 bi\u1ebfn hay d\u00f9ng. <\/p>\n<ul>\n<li>\u0110\u1ec3 xem danh s\u00e1ch c\u00e1c m\u00e1y in hi\u1ec7n \u0111ang \u0111\u01b0\u1ee3c qu\u1ea3n l\u00fd b\u1edfi CUPS server, ch\u00fang ta: lpstat -p -d ## from cups manual<\/li>\n<li>In m\u1ed9t t\u00e0i li\u1ec7u v\u1edbi m\u00e1y in ng\u1ea7m \u0111\u1ecbnh: lpr filename ## print file using default printer<\/li>\n<li>lpr -P printername filename ## print file using the selected printer; see lpstat -p -d for list of printers<\/li>\n<li>In t\u00e0i li\u1ec7u v\u1edbi s\u1ed1 b\u1ea3n in (copy number): lpr -# num filename ## to print num times<\/li>\n<li>openoffice -p filename.doc ## for doc files<\/li>\n<\/ul>\n<p><b>Qu\u1ea3n l\u00fd phi\u00ean l\u00e0m vi\u1ec7c <\/b><br \/>\u0110\u1ec3 logout m\u00e1y t\u00ednh t\u1eeb terminal, trong Ubuntu 10.10, b\u1ea1n g\u00f5 l\u1ec7nh: <\/p>\n<div>gnome-session-save &#8211;logout<\/div>\n<p>\u0110\u1ec3 lock m\u00e1y t\u00ednh t\u1eeb terminal, trong Ubuntu 10.10, g\u00f5 l\u1ec7nh: <\/p>\n<div>gnome-screensaver-command -l<\/div>\n<p><b>Xem phi\u00ean b\u1ea3n (release) h\u1ec7 \u0111i\u1ec1u h\u00e0nh Ubuntu<\/b><\/p>\n<ul>\n<li>uname -r<br \/>uname -a<\/li>\n<li>cat \/etc\/*-release<br \/>cat \/etc\/*version<\/li>\n<li>lsb_release -a<\/li>\n<\/ul>\n<p><b>Xem calendar<\/b><br \/>Xem <a href=\"http:\/\/www.shivaranjan.com\/2009\/04\/19\/ubuntu-linux-tip-how-to-quickly-view-calendar-in-terminal\/\">link<\/a> nay. L\u1ec7nh c\u01a1 b\u1ea3n: cal<\/p>\n<p><b>Li\u1ec7t k\u00ea c\u00e1c th\u01b0 m\u1ee5c \u0111ang chia s\u1ebb<\/b><br \/>C\u00e1ch 1: S\u1eed d\u1ee5ng GUI \u0111\u1ec3 xem, nh\u01b0ng v\u1edbi c\u00e1ch n\u00e0y th\u00ec kh\u00f4ng hi\u1ec3n th\u1ecb t\u1ea5t c\u1ea3 c\u00e1c th\u01b0 m\u1ee5c chia s\u1ebb (ch\u01b0a gi\u1ea3i th\u00edch \u0111\u01b0\u1ee3c). \u0110\u1ec3 m\u1edf c\u1eeda s\u1ed5 n\u00e0y, l\u1ea7n l\u01b0\u1ee3t click v\u00e0o menu System > Administration > Shared Folders. Xem h\u00ecnh b\u00ean d\u01b0\u1edbi.<\/p>\n<div><a href=\"http:\/\/2.bp.blogspot.com\/-ibpNQdhTxPY\/TnJUjp8lQXI\/AAAAAAAABJw\/Y9Wqu042oXY\/s1600\/sf1.png\" imageanchor=\"1\"><img loading=\"lazy\" decoding=\"async\" border=\"0\" height=\"246\" src=\"http:\/\/2.bp.blogspot.com\/-ibpNQdhTxPY\/TnJUjp8lQXI\/AAAAAAAABJw\/Y9Wqu042oXY\/s400\/sf1.png\" width=\"400\"\/><\/a><\/div>\n<p>N\u1ebfu tr\u01b0\u1eddng h\u1ee3p b\u1ea1n kh\u00f4ng th\u1ea5y m\u1ee5c Shared Folders, c\u00f3 th\u1ec3 n\u00f3 kh\u00f4ng \u0111\u01b0\u1ee3c hi\u1ec3n th\u1ecb trong menu Administration. Khi \u0111\u00f3, b\u1ea1n m\u1edf ch\u1ec9nh s\u1eeda m\u1ed9t ch\u00fat l\u00e0 ch\u1ee9c n\u0103ng s\u1ebd hi\u1ec3n th\u1ecb tr\u1edf l\u1ea1i. C\u00e1c b\u01b0\u1edbc th\u1ef1c hi\u1ec7n: System > References > Main Menu, c\u1eeda s\u1ed5 xu\u1ea5t hi\u1ec7n nh\u01b0 h\u00ecnh b\u00ean d\u01b0\u1edbi:<\/p>\n<div><a href=\"http:\/\/2.bp.blogspot.com\/-DTt6upABCl8\/TnJUrCleqmI\/AAAAAAAABJ0\/0JCEykZEeHo\/s1600\/mn2.png\" imageanchor=\"1\"><img loading=\"lazy\" decoding=\"async\" border=\"0\" height=\"328\" src=\"http:\/\/2.bp.blogspot.com\/-DTt6upABCl8\/TnJUrCleqmI\/AAAAAAAABJ0\/0JCEykZEeHo\/s400\/mn2.png\" width=\"400\"\/><\/a><\/div>\n<p>T\u1ea1i c\u1eeda s\u1ed5, k\u00e9o thanh cu\u1ed9n d\u1ecdc (khung b\u00ean tr\u00e1i) \u0111\u1ec3 ch\u1ecdn Administration, \u0111\u00e1nh d\u1ea5u check v\u00e0o m\u1ee5c Shared Folders b\u00ean ph\u1ea3i. Th\u1ebf l\u00e0 b\u1ea1n s\u1ebd c\u00f3 ch\u1ee9c n\u0103ng n\u00e0y hi\u1ec3n th\u1ecb tr\u00ean menu Administration.<br \/>C\u00e1ch 2: D\u00f9ng l\u1ec7nh t\u1eeb terminal<br \/>1. smbclient -L localhost<br \/>M\u1ed7i l\u1ea7n ch\u1ea1y l\u1ec7nh n\u00e0y l\u00e0 m\u1ed9t l\u1ea7n cung c\u1ea5p m\u1eadt kh\u1ea9u. K\u1ebft qu\u1ea3 hi\u1ec7n th\u1ecb t\u01b0\u01a1ng t\u1ef1 nh\u01b0 h\u00ecnh sau:<\/p>\n<div><a href=\"http:\/\/2.bp.blogspot.com\/-VdgVOgRIiH0\/TnJVlCHdhDI\/AAAAAAAABJ4\/yif5z_ExvRU\/s1600\/sf2.png\" imageanchor=\"1\"><img loading=\"lazy\" decoding=\"async\" border=\"0\" height=\"342\" src=\"http:\/\/2.bp.blogspot.com\/-VdgVOgRIiH0\/TnJVlCHdhDI\/AAAAAAAABJ4\/yif5z_ExvRU\/s400\/sf2.png\" width=\"400\"\/><\/a><\/div>\n<p>2.\u00a0ls -l \/var\/lib\/samba\/usershares<br \/>V\u1edbi l\u1ec7nh n\u00e0y, t\u1ea5t c\u1ea3 c\u00e1c th\u01b0 m\u1ee5c \u0111\u01b0\u1ee3c chia s\u1ebb th\u00f4ng qua d\u1ecbch v\u1ee5 Nautilus s\u1ebd \u0111\u01b0\u1ee3c hi\u1ec3n th\u1ecb ra. V\u00ed d\u1ee5, b\u1ea1n c\u00f3 th\u01b0 m\u1ee5c chia s\u1ebb c\u00f3 t\u00ean l\u00e0 these. Th\u1ebf th\u00ec, \u0111\u1ec3 l\u1ea5y \u0111\u01b0\u1eddng d\u1eabn v\u1eadt l\u00fd tr\u00ean m\u00e1y t\u00ednh, ch\u1ea1y l\u1ec7nh sau:<\/p>\n<p>cat \/var\/lib\/samba\/usershares\/billymusic | grep path<\/p>\n<p>3. T\u1ea1o m\u1ed9t script nh\u01b0 sau:<br \/>shares=$(ls -l \/var\/lib\/samba\/usershares | awk &lsquo;{print \u00ab\u00a0\/var\/lib\/samba\/usershares\/\u00a0\u00bb$8}&rsquo;) <br \/>for i in $shares <br \/>do <br \/>cat $i | grep path <br \/>done<\/p>\n<div><\/div>\n<div>P\/S: \u0110o\u1ea1n scipt sau \u0111\u00e2y \u0111\u1ec3 h\u1ee7y chia s\u1ebb t\u1ea5t c\u1ea3 c\u00e1c th\u01b0 m\u1ee5c:<\/div>\n<div>\n<pre>#!\/bin\/sh<br \/>shares=$(ls -l \/var\/lib\/samba\/usershares | awk '{print $8}')<br \/>for i in $shares<br \/>do<br \/>net usershare delete $i<br \/>done<br \/><\/pre>\n<\/div>\n<div>\n<b>Mount m\u1ed9t file iso<\/b><br \/>T\u1ea1o m\u1ed9t th\u01b0 m\u1ee5c \u0111\u1ec3 mount file iso, gi\u1ea3 s\u1eed \/mnt\/disk. Th\u1ef1c hi\u1ec7n l\u1ec7nh sau:<br \/><code>sudo mount -o loop -t iso9660 file.iso \/mnt\/disk<\/code><br \/><code><br \/><\/code><br \/><b>T\u00ecm ki\u1ebfm t\u1eadp tin<\/b><code>find \/usr\/local\/texlive -name \"*.sty\"<\/code><br \/><code><br \/><\/code>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In \u1ea5nL\u1ec7nh lpr l\u00e0 s\u1eed d\u1ee5ng \u0111\u1ec3 in t\u00e0i li\u1ec7u trong m\u00f4i tr\u01b0\u1eddng Linux do g\u00f3i CUPS cung c\u1ea5p. \u0110\u00e2y l\u00e0 to\u00e0n b\u1ed9 h\u01b0\u1edbng d\u1eabn. B\u00ean d\u01b0\u1edbi ch\u1ec9 t\u00f3m t\u1eaft&hellip; <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[174,228,189,223,176],"tags":[717,572,570],"class_list":["post-836","post","type-post","status-publish","format-standard","hentry","category-linux","category-programming-editor","category-terminal","category-tips-tricks","category-ubuntu","tag-linux","tag-terminal","tag-ubuntu"],"_links":{"self":[{"href":"https:\/\/www.itersdesktop.com\/fr\/wp-json\/wp\/v2\/posts\/836","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itersdesktop.com\/fr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itersdesktop.com\/fr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itersdesktop.com\/fr\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itersdesktop.com\/fr\/wp-json\/wp\/v2\/comments?post=836"}],"version-history":[{"count":1,"href":"https:\/\/www.itersdesktop.com\/fr\/wp-json\/wp\/v2\/posts\/836\/revisions"}],"predecessor-version":[{"id":2222,"href":"https:\/\/www.itersdesktop.com\/fr\/wp-json\/wp\/v2\/posts\/836\/revisions\/2222"}],"wp:attachment":[{"href":"https:\/\/www.itersdesktop.com\/fr\/wp-json\/wp\/v2\/media?parent=836"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itersdesktop.com\/fr\/wp-json\/wp\/v2\/categories?post=836"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itersdesktop.com\/fr\/wp-json\/wp\/v2\/tags?post=836"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}