{"id":7912,"date":"2021-06-04T20:20:49","date_gmt":"2021-06-04T20:20:49","guid":{"rendered":"https:\/\/ded9.com\/?p=7912"},"modified":"2025-12-08T11:01:49","modified_gmt":"2025-12-08T11:01:49","slug":"20-linux-tricks-that-worth-to-try-these-tricks-and-tricks-are-shared-by-our-readers","status":"publish","type":"post","link":"https:\/\/ded9.com\/tr\/20-linux-tricks-that-worth-to-try-these-tricks-and-tricks-are-shared-by-our-readers\/","title":{"rendered":"20 Linux Tricks That Are Worth Trying \u2014 Shared by Real Users"},"content":{"rendered":"<p><span style=\"font-size: 12pt;\"><span style=\"font-size: 12pt;\">Our Reade<\/span><span style=\"font-size: 12pt;\">rs<\/span><span style=\"font-size: 12pt;\"> share these Tricks<\/span>. You Can Also Participate by Sharing Your Trick, Which We Will Share With Other Readers.<\/span><\/p>\n<p>Want to play with your favorite open-source operating system? We&#8217;ll help you do that better. Keeping the Linux philosophy of sharing intact, we offer 20 tricks worth trying.<\/p>\n<h2><span style=\"font-size: 18pt;\">Our readers share these tricks.<\/span><\/h2>\n<p>You can also share some of these tricks with other readers.<\/p>\n<p>Increase or decrease the number shown in the Vim editor.<\/p>\n<p>This trick adds or subtracts a number in the Vim editor.\u00a0Use Ctrl + A to increase and Ctrl + X to decrease.<\/p>\n<p>The following example further illustrates how this works.<\/p>\n<p>Suppose a number, 5, is currently being edited in Vim Editor. If you want to increase or decrease the number to 1, place the mouse cursor on the number and press Ctrl + A to increase it (for example, the number becomes 6). If you press Ctrl + A again, it becomes 6 to 7, and so on. In the same way, if you press Ctrl + X, the number drops to 1.<\/p>\n<p>If you hit eight and then press Ctrl + X, the number decreases to 8. Similarly, if you press 12 and then Ctrl + A, the number increases to 12.<\/p>\n<p>\u2014AdithyaKiranGangu,<\/p>\n<h3><strong>Search and delete files from a folder<\/strong><\/h3>\n<p>If you want to delete all .lock files from a folder, use the following command:<\/p>\n<p>find -name * .lock |\u00a0xargsrm \u2013 rf<\/p>\n<p>This will find and delete all files with the .lock attachment. You can use this method to delete all the files you want.<\/p>\n<p>\u2014Bridal,<\/p>\n<h3><strong>Easy to get the correct information<\/strong><\/h3>\n<p>Beginners working in the GNU\/Linux ecosystem sometimes have trouble getting the correct information from a piece that isn&#8217;t working correctly. While this information is required to start the device, this command provides details on all PCI devices and their associated Kernel drivers.<\/p>\n<p>Run the terminal and log in as the root user. Run the following command now:<\/p>\n<p>lspci \u2013 k<\/p>\n<p>Ispci gives you information about PCI jacks and the devices connected to them, and\u2014k switches the display to the kernel module running on the device. So, if this file does not exist on a device, you need to install the driver for that device.<\/p>\n<p>\u2014Pankaj Tanwar,<\/p>\n<h2><strong>Converting numbers in<a href=\"https:\/\/en.wikipedia.org\/wiki\/Vim_(text_editor)\" target=\"_blank\" rel=\"noopener\"> the Vim editor<\/a><\/strong><\/h2>\n<p>With this trick, you can<strong>\u00a0convert<\/strong> Vim editor numbers based on 16 to decimal numbers and vice versa. To convert numbers from base 16 to decimal numbers, type the following text in the Vim editor:<\/p>\n<p>echo 0x111<\/p>\n<p>Then press Enter to get the result:<br \/>\n273<br \/>\nYou can also use the following command to convert a number:<\/p>\n<p>: echoprintf (&#8216;% d&#8217;, 0x111)<\/p>\n<p>273<\/p>\n<p>Now, to convert decimal numbers to 16 &#8230;<\/p>\n<p>: echoprintf (&#8216;% x&#8217;, 273)<br \/>\n111<\/p>\n<p>You can also run a simple account from the Vim grammar section, for example:<\/p>\n<p>: echoprintf (&#8216;% x&#8217;, 273-173)<\/p>\n<p>64<\/p>\n<p>: echo 0x111-0x10<\/p>\n<p>257<\/p>\n<p>\u2014AdithyaKiranGangu,<\/p>\n<h2><span style=\"font-size: 18pt;\"><strong>Using vi commands on the\u00a0<\/strong><\/span><span style=\"box-sizing: border-box; margin: 0px; padding: 0px;\"><strong><span style=\"font-size: 18pt;\">terminal<\/span><\/strong><\/span><\/h2>\n<p><span style=\"font-size: 16px;\"> makes your job much easier. To set the terminal to vi mode, you must use the following command: set<\/span><span style=\"font-size: 16px;\">\u00a0-o vi.<\/span><\/p>\n<p>You can now use the command (command and insert) modes and the vi extension in the terminal.<\/p>\n<p>\u2014Dipjyoti Ghosh,<\/p>\n<h3><strong>Obtaining an <a href=\"https:\/\/ded9.com\/blocked-ip-address-how-to-fix-it-solving-the-problem-of-ip-blocking-in-the-server-firewall\/\">IP Address<\/a><\/strong><\/h3>\n<p>Here is a one-line command that fetches all your computer&#8217;s IP addresses except localhost:<\/p>\n<p># ifconfig |\u00a0grep \u201cinetaddr:\u201d |\u00a0awk &#8216;{print $ 2}&#8217; |\u00a0grep -v &#8216;127.0.0.1&#8217; |\u00a0cut -f2 -d:<\/p>\n<p>Note: Use the above command as the root user.<\/p>\n<p>\u2014BalkaranBrar,<\/p>\n<h2><span style=\"font-size: 18pt;\"><strong>Get your system to talk to you!<\/strong><\/span><\/h2>\n<p>You can get your system to talk using the Speech Synthesizer command, which is commonly available in Ubuntu and other versions of Linux.<br \/>\nTo do this, use the following command:<\/p>\n<p># espeak &#8220;hello, how are you?u&#8221;<\/p>\n<p>You will hear the voice talking to you.<br \/>\nYou can use the following command in the format shown to change the pitch:<\/p>\n<p># espeak -p 80 &#8220;hell,o how are y?ou.&#8221;<\/p>\n<p>&#8230; (Default is 50)<br \/>\nUsing the following grammatical form will control the speaking speed in &#8220;word count per minute&#8221; mode:<\/p>\n<p># espeak -s 80 &#8220;hello, how are you?u&#8221;<\/p>\n<p>\u2014Sanjay Goswami,<\/p>\n<p><strong>Measuring the network output power between two<\/strong><\/p>\n<p>Iperf<strong> is a Linux tool<\/strong>\u00a0for measuring bandwidth and network connection quality. It can be easily installed on any Linux operating system. One host should be the client, and the other the server.<\/p>\n<p>Make sure Iperf is installed on both operating systems.\u00a0If it is not installed, use your package manager to install it, then use the following trick.<br \/>\nNow run Iperf on one of the operating systems called a server, as shown below:<\/p>\n<p>Linux-erv3: \/ home \/ test \/ Desktop # iperf -s<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;-<br \/>\nServer listening on TCP port 5001<\/p>\n<p>TCP window size: 85.3 KByte (default)<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Now go to the next system and run Iperf-c as a client:<\/p>\n<p>Linux-6bg3: ~ # iperf -c 192.168.1.100<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;-<br \/>\nClient connecting to 192.168.1.100, TCP port 5001<br \/>\nTCP window size: 16.0 KByte (default)<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n[3] local 192.168.1.109 port 39572 connected with 192.168.1.100 port 5001<\/p>\n<p>^ C [ID] Interval Transfer Bandwidth<\/p>\n<p>[3] 0.0- 6.3 sec 6.38 MBytes 8.51 Mbits \/ sec<\/p>\n<p>By default, the Iperf client connects to the Iperf server on TCP port 5001, and the bandwidth reported by Iperf is the bandwidth from the client to the server. In the example above, the two Linux test systems were connected at 8.51 Mbits\/sec via a Wi-Fi network.<\/p>\n<p>\u2014Prasanna,<\/p>\n<p><strong>Record everything you do in the terminal<\/strong>.<\/p>\n<p>Have you ever felt that you must save everything you do in the terminal to a file? Use the following trick. The script command can be used with the -a option to save a job&#8217;s output to a file.<br \/>\nThe following example illustrates how it works:<\/p>\n<p>Mandriva ~: $ script -a lfy<br \/>\nScript started; the file is lfy<br \/>\nMandriva ~: $ uname -a<br \/>\nLinux localhost.localdomain 2.6.33.5-desktop-2mnb # 1 SMP Thu Jun 17 21:30:10 UTC 2010 i686 i686 i386 GNU \/ Linux<br \/>\nMandriva ~: $ uname<br \/>\nLinux<br \/>\nMandriva ~: $ exit<br \/>\nexit<br \/>\nScript done, file is lfy<\/p>\n<p>Here is the name of the file. You can later use the following code to make sure it is correct:<\/p>\n<p>Mandriva ~: $ cat lfy<br \/>\nScript started on Mon May 16, 2011 02:09:47 AM EDT<br \/>\nMandriva ~: $ uname -a<br \/>\nLinux localhost.localdomain 2.6.33.5-desktop-2mnb # 1 SMP Thu Jun 17 21:30:10 UTC 2010 i686 i686 i386 GNU \/ Linux<br \/>\nMandriva ~: $ uname<br \/>\nLinux<br \/>\nMandriva ~: $ exit<br \/>\nexit<\/p>\n<p>Script done on Mon May 16, 20111 02:10:32 AM EDT<\/p>\n<p>\u2014Sibi,<\/p>\n<p><strong>Wonders of VIM<\/strong><\/p>\n<p>VIM has widely used command codes. Here are some tips to boost your productivity.<\/p>\n<p>VIM as a job comparator:<\/p>\n<p>Use the &#8216;-d button to compare two files in VIM. This command halves the VIM screen vertically and shows the differences.<\/p>\n<p>vim -d file1 file2<\/p>\n<p><strong>Upload new files in separate windows<\/strong><\/p>\n<p>If you have a pre-loaded file called first.txt in VIM, use &#8216;: split second.txt&#8217; to create another file called &#8216;second.txt&#8217; in a single window. Load separately &#8211; IM halves the page horizontally and loads the second file. You can use &#8216;: vsplit&#8217; to split the page vertically in half. You can use Ctrl-W to switch between windows.<\/p>\n<p><strong>VIM as a command<\/strong><\/p>\n<p>Usually, we use VIM as an editor; however, it can also be used as a command-line tool. For example, pressing the &#8216;-c&#8217; button allows the execution of VIM commands. Without running VIM, this command replaces all &#8216;&gt;&#8217; characters with &#8216;&gt;&gt;&gt;&#8217; characters in a FILE.TXT file.<\/p>\n<p>vim -c \u201c: s \/&gt; \/ &gt;&gt; \/ g\u201d -c \u201c: wq\u201d FILE.TXT<\/p>\n<p>To open a file in read-only mode:<br \/>\nUse the &#8216;-R&#8217; button to open a file in read-only mode. Later, using &#8216;!&#8217;, you can write to the file.<\/p>\n<p>\u2014Satya Prakash,<\/p>\n<p><strong>Check the processor and the architecture of your operating system.<\/strong><\/p>\n<p>You may want to install a 64-bit operating system on your device, but the processor may only support 32-bit. Sometimes, the opposite is true when you want to install a 32-bit operating system on a device with a 64-bit processor.<\/p>\n<p>This method allows you to determine the operating system type and even the processor architecture, whether 32-bit or 64-bit.<\/p>\n<p>Execute the following command to get details of the type of operating system that is installed:<\/p>\n<p>uname \u2013 m\u00a0<strong>$<\/strong><\/p>\n<p>If the operating system is 64-bit, then the result (for x86_64 architecture) is as follows:<\/p>\n<p>x86_64<\/p>\n<p>If the operating system is not 64-bit, the result (for i686 architecture) is as follows:<\/p>\n<p>i686<\/p>\n<p>To get information about the processor, run the following command:<\/p>\n<p>lshw -class processor |\u00a0grep width\u00a0$<\/p>\n<p>The result shown below is 64-bit:<\/p>\n<p>width: 64 bits<\/p>\n<p>If it is a 32-bit type, then the result:<\/p>\n<p>width: 32 bits<\/p>\n<p>Note: Please install lshw if it is not installed on your system.<\/p>\n<p>\u2014SrikanthVittal<\/p>\n<p><strong>Sudoing with Fedora<\/strong><\/p>\n<p>Have you ever felt tired of entering the password several times after typing &#8216;su -c&#8217;? Type &#8216;su -c visudo&#8217; once and remove the line:<\/p>\n<p>#% wheel ALL = (ALL).ALL<\/p>\n<p>Replace the &#8216;wheel&#8217; with your Sudo password. So if your password is egghead, this is how the line looks.<\/p>\n<p>% egghead ALL = (ALL) ALL<\/p>\n<p>Save and then leave. You did a good job choosing egghead as a sudo user.<\/p>\n<p>\u2014A. Datta,<\/p>\n<p><strong>Let your Linux system welcome you.<\/strong><\/p>\n<p>Write the following line and name it welcome. sh<\/p>\n<p>echo &#8220;Hi zades, you are welcome today is &#8220;| festival &#8211;tts<br \/>\ndate | cut -d&#8221; &#8220;-f 1-3 | festival \u2013tts<\/p>\n<p>Now, put the command sh welcome. Sh in a start-up. This will give the script the execution components with each login. Once done, restart your system to hear the message written in the Echo command.<\/p>\n<p>The festival command is used to convert text to speech. You can use this command in several ways, depending on your creativity. Remember to install the festival before performing this trick.<\/p>\n<p>\u2014Vinay Jhedu,<\/p>\n<p><strong>Ignoring letters during tab-completion (TAB-completion)<\/strong><\/p>\n<p>By default, tab completion (TAB completion) will not be useful when the file name or location starts with a capital letter. You can make Shell ignore uppercase or lowercase letters by adding the following input in \/ etc \/ inputrc:<\/p>\n<p>set completion-ignore-case on<\/p>\n<p>Then, restart the shell. From now on, TAB-completion will complete file and address names by completely ignoring letters.<\/p>\n<p>Remember to apply changes to inputrc only as a root user.<\/p>\n<p>manreadline<\/p>\n<p>\u2014Sachin P,<\/p>\n<p><strong>Operating System Detection and Distribution Name<\/strong><\/p>\n<p>Here is a trick that allows you to know your operating system name along with other details:<\/p>\n<p># lsb_release -a<\/p>\n<p>LSB Version:: core-3.1-ia32: core-3.1-noarch: graphics-3.1-ia32: graphics-3.1-noarch<\/p>\n<p>Distributor ID: CentOS<\/p>\n<p>Description: CentOS release 5.5 (Final)<\/p>\n<p>Release: 5.5<\/p>\n<p>Codename: Final<\/p>\n<p>\u2014Narendra Kangralkar,<\/p>\n<p><strong>View tar contents and rpm files<\/strong><\/p>\n<p>Here are two simple commands that will show you the tar contents and RPM files:<\/p>\n<p>#tar -tvf \/path\/to\/file.tar<\/p>\n<p>Use the following command to view the contents of an RPM file:<\/p>\n<p>#rpm -qlp \/path\/to\/file.rpm<\/p>\n<p>\u2014Giriraj G Rajasekharan,<\/p>\n<p><strong>Play MP3 files<\/strong><\/p>\n<p>With this trick, you can cut, separate, and merge MP3 files on Ubuntu, improving the output quality.<\/p>\n<p>To cut an MP3 file, you need to install the POC-streamer program as follows:<\/p>\n<p>$ sudo apt-get install POC-streamer. Here&#8217;s how\u00a0to cut an MP3:<\/p>\n<p>mp3cut [-o outputfile] [-T title] [-A artist] [-N album-name] [-t [hh:] mm: ss [+ ms] &#8211; [hh:] mm: ss [+ ms]] mp3 [-t &#8230;] mp3 -o output: Output file, default mp3file.out.mp3<\/p>\n<p>For example, if you want to cut a minute from an MP3 clip called input.mp3 to a .wav file called output.wav, use the following command:<\/p>\n<p>$ mp3cut -o output.wav -t 00:00 (+0) -01: 00 (+0) input.mp3<\/p>\n<p>If you want to connect two MP3 files, you need to install the MP3wrap program as follows:<\/p>\n<p>$ sudo apt-get install mp3wrap<\/p>\n<p>How to arrange MP3wrap is shown below:<\/p>\n<p>$ mp3wrap merged_filename.mp3 filename1.mp3 filename2.mp3<\/p>\n<p>&#8230; When filename1.mp3 and filename2.mp3 are my input files to merge.<\/p>\n<p>Finally, you can convert a large MP3 file to a small file by installing the MP3Split app:<\/p>\n<p>$ sudo apt-get install mp3splt<\/p>\n<p>Now, to fragment the file, run the following command:<\/p>\n<p>$ mp3splt filename.mp3 00.00 01.23 03.20<\/p>\n<p>Filename.mp3 is my input file, which can be split into two MP3 files. One starts from zero to 01:23, and the other from one to twenty-three until 3:20. Mp3split can create smaller files without file conversion.<\/p>\n<p>\u2014RajasekharChintalpudi,<\/p>\n<p><strong>GRUB 2 Recovery<\/strong><\/p>\n<p>Sometimes, our boot loader crashes. Here are some steps to help you recover your GRUB 2 boot loader.<\/p>\n<p>Boot from a live CD or DVD that supports GRUB 2 (e.g., Ubuntu 9.10 or higher). DVDs take DVDs, so I recommend booting from a CD.<\/p>\n<p>Open the tCDs terminal and run fdisk \u2013 l to select the partition from which you want to recover GRUB 2<\/p>\n<p>We assume you want to recover it from \/ dev \/ sda1.<\/p>\n<p>Then run the following commands:<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-7915\" src=\"https:\/\/ded9.com\/wp-content\/uploads\/2021\/06\/Capture-1.jpg\" alt=\"\" width=\"328\" height=\"145\" srcset=\"https:\/\/ded9.com\/wp-content\/uploads\/2021\/06\/Capture-1.jpg 328w, https:\/\/ded9.com\/wp-content\/uploads\/2021\/06\/Capture-1-300x133.jpg 300w\" sizes=\"(max-width: 328px) 100vw, 328px\" \/><\/p>\n<p>Now chroot the partition by executing the following command:<\/p>\n<p>$ sudochroot \/ media \/ sda1<\/p>\n<p>Then reinstall GRUB as follows:<\/p>\n<p># grub-install \/ dev \/ sda<\/p>\n<p>The output should look something like this:<\/p>\n<p>Installation finished. No error was reported.<\/p>\n<p>If you get an error message, try the following command:<\/p>\n<p># grub-install &#8211;recheck\/dev \/ sda<\/p>\n<p>After successful installation, exit chroot and unmount the file systems mounted for GRUB recovery. Reboot now.<\/p>\n<p>#exit<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-7914\" src=\"https:\/\/ded9.com\/wp-content\/uploads\/2021\/06\/Capture.jpg\" alt=\"\" width=\"255\" height=\"139\" \/><\/p>\n<p>You have completed your GRUB boot loader recovery.<\/p>\n<p>\u2014Kousik Maiti,<\/p>\n<div class=\"block-rawScript\">\n<div id=\"ynpos-8232\" class=\"yn-bnr processed\">\n<h2>FAQ<\/h2>\n<div id=\"rank-math-rich-snippet-wrapper\"><div id=\"rank-math-faq\" class=\"rank-math-block\">\n<div class=\"rank-math-list \">\n<div id=\"faq-1\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">Do these Linux tricks require advanced knowledge?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Not always \u2014 many are simple command-line shortcuts or common-sense practices useful even for beginners.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-2\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">Can these tricks improve productivity?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Yes \u2014 they streamline everyday tasks like navigation, file handling, and system management, saving time and reducing effort.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-3\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">Are these tricks safe to use on any Linux distribution?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Most are generic command-line or shell tricks that work across distributions, but check compatibility (commands &amp; permissions) before applying.<\/p>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div><\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Our Readers share these Tricks. You Can Also Participate by Sharing Your Trick, Which We Will Share With Other Readers. Want to play with your favorite open-source operating system? We&#8217;ll help you do that better. Keeping the Linux philosophy of sharing intact, we offer 20 tricks worth trying. Our readers share these tricks. You can [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":7913,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[69],"tags":[12016,3164],"class_list":["post-7912","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-grub","tag-ip-address"],"acf":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/posts\/7912","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/comments?post=7912"}],"version-history":[{"count":4,"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/posts\/7912\/revisions"}],"predecessor-version":[{"id":265930,"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/posts\/7912\/revisions\/265930"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/media\/7913"}],"wp:attachment":[{"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/media?parent=7912"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/categories?post=7912"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/tags?post=7912"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}