{"id":352,"date":"2010-02-09T16:26:35","date_gmt":"2010-02-09T15:26:35","guid":{"rendered":"http:\/\/lackovic.wordpress.com\/?p=352"},"modified":"2015-01-12T09:49:57","modified_gmt":"2015-01-12T09:49:57","slug":"useful-linux-howtos","status":"publish","type":"post","link":"https:\/\/scalab.dimes.unical.it\/lackovic\/useful-linux-howtos\/","title":{"rendered":"Useful Linux howtos"},"content":{"rendered":"<h2>Applications<\/h2>\n<ul>\n<li>to install <span style=\"color: #ff0000;\">Oracle Java JDK<\/span> follow <a href=\"http:\/\/www.wikihow.com\/Install-Oracle-Java-JDK-on-Ubuntu-Linux\">these instructions<\/a>;<\/li>\n<li>to <span style=\"color: #ff0000;\">compare files or directories<\/span> use &#8220;Meld Diff Viewer&#8221;. You can install it by running:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">sudo apt-get install meld<\/pre>\n<\/li>\n<li>to install <span style=\"color: #ff0000;\">Microsoft&#8217;s Core Font package<\/span> run:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">sudo apt-get install ttf-mscorefonts-installer<\/pre>\n<\/li>\n<li>to <span style=\"color: #ff0000;\">synchronize folders, files and make backups<\/span> use &#8220;Conduit Synchronizer&#8221;. You can install it by running:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">sudo apt-get install conduit<\/pre>\n<\/li>\n<li>to <span style=\"color: #ff0000;\">change grub settings<\/span> (e.g. to change your default operating system, etc) install &#8220;StartUp Manager&#8221; by running:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">sudo apt-get install startupmanager<\/pre>\n<\/li>\n<li>to automatically <span style=\"color: #ff0000;\">mount at boot your NTFS partitions<\/span> install &#8220;Storage Device Manager&#8221; by running:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">sudo apt-get install pysdm<\/pre>\n<\/li>\n<li>to <span style=\"color: #ff0000;\">set up a repository cache\u00a0<\/span>on your network so that once a package is downloaded from an official repository, all other machines will download it from your local area network, install <strong>squid-deb-proxy<\/strong>\u00a0(and its client so the server downloaded\u00a0updates get cached by the squid proxy and will also allow the server to install already-fetched updates via the proxy) on your server machine by running:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">sudo apt-get install squid-deb-proxy\u00a0squid-deb-proxy-client<\/pre>\n<p>then reboot your server machine. Clients can auto-discover caching-enabled machines in the local network by having the <strong>squid-deb-proxy-client<\/strong> package installed. To do that simply run:<\/p>\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">sudo apt-get install squid-deb-proxy-client<\/pre>\n<\/li>\n<\/ul>\n<h2>Information<\/h2>\n<ul>\n<li>to know your <span style=\"color: #ff0000;\">IP address<\/span>:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">ifconfig | grep Bcast<\/pre>\n<\/li>\n<li>to know your <span style=\"color: #ff0000;\">hardware details <\/span>and save them in an html page run:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">lshw -html &gt; your-file-name.html<\/pre>\n<p>(a good idea is to generate one for each of your computers and save them up for future reference)<\/li>\n<li>to check whether a certain <span style=\"color: #ff0000;\">package is installed<\/span>:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">dpkg -l | grep packagename<\/pre>\n<\/li>\n<li>to <span style=\"color: #ff0000;\">know whether you need to reboot <\/span>a machine after updating the system via terminal check if the following file exists:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">\/var\/run\/reboot-required<\/pre>\n<\/li>\n<li>to <span style=\"color: #ff0000;\">test the speed of your hard drive <\/span>run:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">sudo hdparm -t \/dev\/sd?<\/pre>\n<\/li>\n<li>to <span style=\"color: #ff0000;\">list running services<\/span> run:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">sudo netstat -tulpn<\/pre>\n<\/li>\n<li>to <span style=\"color: #ff0000;\">check RAM speed, size and frequency<\/span>:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">sudo dmidecode --type 17 | more<\/pre>\n<\/li>\n<li>to <span style=\"color: #ff0000;\">know your processor details <\/span>run:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">cat \/proc\/cpuinfo | grep name<\/pre>\n<\/li>\n<li>to <span style=\"color: #ff0000;\">know the bios version of your motherboard <\/span>run:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">sudo apt-get install smbios-utils\r\nsudo smbios-sys-info<\/pre>\n<\/li>\n<li>to know the name of the <span style=\"color: #ff0000;\">Linux distribution<\/span> installed on your machine run:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">lsb_release -a<\/pre>\n<p>or, if that doesn&#8217;t work then run:<\/p>\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">cat \/etc\/issue<\/pre>\n<\/li>\n<li>to have some <span style=\"color: #ff0000;\">system information<\/span> of your machine run:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">uname -a<\/pre>\n<\/li>\n<li>to see if your operating system architecture is <span style=\"color: #ff0000;\">32-bit or 64-bit<\/span> run:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">file \/sbin\/init<\/pre>\n<\/li>\n<li>to <span style=\"color: #ff0000;\">list all users<\/span> in your system from terminal, run:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">cat \/etc\/passwd | grep \"\/home\" |cut -d: -f1<\/pre>\n<\/li>\n<\/ul>\n<h2>Operations<\/h2>\n<ul>\n<li>to configure your <span style=\"color: #ff0000;\">terminal commands history <\/span>add one or more of the following lines to your ~\/.bashrc file:\n<ul>\n<li>to change name of the file in which command history is saved:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">export HISTFILE=<\/pre>\n<p>(the default value is ~\/.bash_history)<\/li>\n<li>to not save in the history certain command lines add them as a colon-separated list:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">export HISTIGNORE=<\/pre>\n<\/li>\n<li>to not save a line matching any other previous entry in the history:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">export HISTCONTROL=ignoreboth<\/pre>\n<\/li>\n<li>to change the number of commands to remember in the command history:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">export HISTSIZE=500<\/pre>\n<p>(the default value is 500)<\/li>\n<\/ul>\n<\/li>\n<li>to <span style=\"color: #ff0000;\">add aliases system-wide<\/span> you need to edit the file \/etc\/bash.bashrc For example, the following alias will provide a comprehensive update and clean operation:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">alias apt-update='sudo apt-get -f install\r\n&amp;&amp; sudo apt-get autoremove -y\r\n&amp;&amp; sudo apt-get autoclean -y\r\n&amp;&amp; sudo apt-get clean -y\r\n&amp;&amp; sudo apt-get update \r\n&amp;&amp; sudo apt-get upgrade -y --fix-missing'<\/pre>\n<\/li>\n<li>to <span style=\"color: #ff0000;\">boot in text mode <\/span>instead of graphical mode (GUI) open the \/etc\/default\/grub file, locate the following line:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">GRUB_CMDLINE_LINUX_DEFAULT=\u201dquiet splash\u201c<\/pre>\n<p>and change it to:<\/p>\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">GRUB_CMDLINE_LINUX_DEFAULT=\u201dquiet splash text\u201c<\/pre>\n<p>and don&#8217;t forget to run &#8216;update-grub&#8217; afterwards to update. If you need the graphical interface you can still have it by simply running \u201cstartx\u201d once logged in.<\/li>\n<li>to <span style=\"color: #ff0000;\">keep your computer&#8217;s time accurate<\/span> follow <a href=\"https:\/\/help.ubuntu.com\/9.10\/serverguide\/C\/NTP.html\">these<\/a> instructions;<\/li>\n<li>to <span style=\"color: #ff0000;\">install fonts for system-wide <\/span>run:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">mkdir \/usr\/share\/fonts\/truetype\/myfonts\r\ncp [fonts] \/usr\/share\/fonts\/truetype\/myfonts\r\nfc-cache -f -v<\/pre>\n<\/li>\n<li>to <span style=\"color: #ff0000;\">add a new user via terminal <\/span>run:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">sudo adduser username<\/pre>\n<\/li>\n<li>to <span style=\"color: #ff0000;\">add a group to a user<\/span>run:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">sudo adduser username groupname<\/pre>\n<\/li>\n<li>to <span style=\"color: #ff0000;\">modify the groups of a user<\/span>run:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">sudo usermod -G comma,separated,list,of,groupnames username<\/pre>\n<\/li>\n<li>some useful <span style=\"color: #ff0000;\">command line shortcuts<\/span>:\n<ul>\n<li>Ctrl-D: exit from the current session;<\/li>\n<li>Ctrl-R: searching through the command history;<\/li>\n<li>Ctrl-A: moves the cursor to the beginning of the command line;<\/li>\n<li>Ctrl-E: moves the cursor to the end of the command line;<\/li>\n<li>Ctrl-W: deletes the word immediately before the cursor;<\/li>\n<li>Ctrl-K: deletes everything immediately after the cursor;<\/li>\n<li>Ctrl-Y: undo a deletion.<\/li>\n<\/ul>\n<\/li>\n<li>to <span style=\"color: #ff0000;\">start a terminal maximized <\/span>use the command\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">gnome-terminal --window --maximize<\/pre>\n<\/li>\n<li>to <span style=\"color: #ff0000;\">start a terminal in full screen<\/span> use the command\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">gnome-terminal --full-screen<\/pre>\n<\/li>\n<li>to <span style=\"color: #ff0000;\">copy multiple files using scp <\/span>use it like showed below:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">scp {file1,file2,file3} user@destination:~\/<\/pre>\n<\/li>\n<li>to <span style=\"color: #ff0000;\">speed up the ssh connection <\/span>add &#8220;UseDNS no&#8221; (without quotation marks) at the end of your \/etc\/ssh\/sshd_config and then run:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">sudo \/etc\/init.d\/ssh reload<\/pre>\n<\/li>\n<li>to <span style=\"color: #ff0000;\">add a new resolution <\/span> to your monitor\/display\/screen run (assuming you want to add 1600&#215;900):\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">cvt 1600 900<\/pre>\n<p>that will output something like this:<\/p>\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">Modeline \"1600x900_60.00\" 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync<\/pre>\n<p>Copy the text following Modeline and paste it in the following command:<\/p>\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">xrandr --newmode \"1600x900_60.00\" 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync<\/pre>\n<p>Then run the command xrandr alone:<\/p>\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">xrandr<\/pre>\n<p>and note down the connected primary video source (should something like VGA-0, or VGA1). Supposing it&#8217;s VGA-0 then run:<\/p>\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">xrandr --addmode VGA-0 \"1600x900_60.00\"<\/pre>\n<\/li>\n<li>to <span style=\"color: #ff0000;\">open\/extract an eml file<\/span> install munpack:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">sudo apt-get install mpack<\/pre>\n<p>then run:<\/p>\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">munpack filename.eml -t<\/pre>\n<\/li>\n<li>to <span style=\"color: #ff0000;\">chmod 775 sub-directories, files excluded<\/span>:\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">find \/path\/to\/base\/dir -type d -exec chmod 775 {} +<\/pre>\n<p>to <span style=\"color: #ff0000;\">chmod 664 files recursively, sub-directories excluded<\/span>:<\/p>\n<pre style=\"color: black; font: normal normal normal 12px\/18px Consolas, Monaco, 'Courier New', Courier, monospace;\">find \/path\/to\/base\/dir -type f -exec chmod 664 {} +<\/pre>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Applications to install Oracle Java JDK follow these instructions; to compare files or directories use &#8220;Meld Diff Viewer&#8221;. You can install it by running: sudo apt-get install meld to install Microsoft&#8217;s Core Font package run: sudo apt-get install ttf-mscorefonts-installer to synchronize folders, files and make backups use &#8220;Conduit Synchronizer&#8221;. You can install it by running: &hellip; <a href=\"https:\/\/scalab.dimes.unical.it\/lackovic\/useful-linux-howtos\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Useful Linux howtos<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,9,8],"tags":[],"aioseo_notices":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/scalab.dimes.unical.it\/lackovic\/wp-json\/wp\/v2\/posts\/352"}],"collection":[{"href":"https:\/\/scalab.dimes.unical.it\/lackovic\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/scalab.dimes.unical.it\/lackovic\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/scalab.dimes.unical.it\/lackovic\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/scalab.dimes.unical.it\/lackovic\/wp-json\/wp\/v2\/comments?post=352"}],"version-history":[{"count":34,"href":"https:\/\/scalab.dimes.unical.it\/lackovic\/wp-json\/wp\/v2\/posts\/352\/revisions"}],"predecessor-version":[{"id":1570,"href":"https:\/\/scalab.dimes.unical.it\/lackovic\/wp-json\/wp\/v2\/posts\/352\/revisions\/1570"}],"wp:attachment":[{"href":"https:\/\/scalab.dimes.unical.it\/lackovic\/wp-json\/wp\/v2\/media?parent=352"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/scalab.dimes.unical.it\/lackovic\/wp-json\/wp\/v2\/categories?post=352"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/scalab.dimes.unical.it\/lackovic\/wp-json\/wp\/v2\/tags?post=352"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}