Compsmag is supported by its audience. When you buy through links on our website, we may earn an affiliate commission fee. Learn more

7 Handy Command Line Tips You Don’t Want to Miss

Check tutorial of 7 Handy Command Line Tips You Don’t Want to Miss

So after a lot of requests from our users here is a guide about 7 Handy Command Line Tips You Don’t Want to Miss.

It is often a matter of learning a few commands to become familiar with the command line tricks and find uses for them, and we provide six useful ones tricks which you will almost certainly find some use regardless of your skill level in the Terminal.

Read on, you’ll download files, use a better directory listing, kill processes faster, run previous commands as root, find previous commands, and create new files in no time.

1: Download a file from the internet and watch the progress

Do you know the URL of a file to download from the Internet? Use curl with the -O command to download it:

curl -O url

Make sure to use the full URL. Also, don’t forget to use the uppercase letter ‘O’ and not the lowercase letter ‘o’ to keep the same file name on your local computer.

For example, the following command downloads the iOS 7 IPSW file from Apple’s servers to the local Mac, keeping the same file name as on the remote server:

curl -O http://appldnld.apple.com/iOS7/091-9495.20130918.FuFu4/iPhone5,1_7.0_11A465_Restore.ipsw

We’ve covered this trick a long time ago and it is really helpful. Since it shows download speeds and progress, it can also function as an alternative to the wget trick to test the speed of an internet connection from the command line.

2: List of directory contents by modification date

Want to display a long list of a directory, with permissions, users, file size and modification date, with the most recently modified files and folders at the bottom up? Of course you do:

ls -thor

This is extremely useful, and also easy to remember, because the command flag is thor, and how can you ever forget the mythological thor?

3: Search Spotlight with live results from the command line

The mdfind tool is a command line front end of the excellent Spotlight search tool, usually accessible from the Finder. But in the default state, mdfind differs from Spotlight search in that it doesn’t update the results live as found. That’s what this trick is for, a simple flag will spotlight search from the command line with live update results:

mdfind -time findme

This can be very fast depending on the specificity of the searched terms, but when you see a match, hit Control + C to stop searching.

If you’ve turned off Spotlight or if you find it not working, you can always fall back on the familiar ‘find’ command.

4: Kill processes with wildcards

Ever wish you could kill lots of processes or commands at once using wildcards? Or do you just want to kill something faster without typing the full process name or pid? The standard kill command does not accept wildcards, but pkill accepts wildcards, making it the right choice for the job.

For example, if you want to terminate every active instance of the “SampleEnormousTaskNameWhyIsThisProcessNameSoLong” process at once, you can use:

pkill Sam *

Remember wildcards are relentless, and pkill will end tasks without hesitation or request for storage, so if you have other closely matching process names these will be killed too. The easiest way to get around that is to just specify a slightly longer task name element to target.

You can also use pkill to target all specific user processes, which can be helpful in some situations on Macs with multiple users.

5: Run the last command as root again

Don’t you hate it when you’re going to run a long command and find out after hitting enter that it requires a super user to run? You know, like one of those standard commands? Don’t retype the entire command string, use this simple one trick instead:

sudo !!

This is an oldie-but-goodie trick that’s been around for ages, and it’s sure to get a lot of use the more time you spend at the command line.

6: Get the last occurrence of a command without running it

Can’t remember the exact syntax you used the last time you ran a specific command? You can find it immediately without running the command again by using this trick, where ‘search term’ is the matching command:

! search term: p

For example, to find the last full command that used the ‘sudo’ prefix, you would use:

! sudo: p

This reports something like the following, giving you the full command syntax but not running it again:

sudo vi / etc / motd

Again, this trick reports only the last time a command was used based on a prefix. If you really need to dig through your previous command list, you can search your bash history with grep.

7: Immediately create an empty file or multiple files

The touch command makes quick work of creating empty files, for space holders, testing, demonstrations, or whatever your plans are. The secret is the ‘touch’ command and it’s easy to use:

tap file name

You can specify multiple names to create multiple files as well. For example, this would create three files named index, gallery and resume, each with the html extension:

tap index.html gallery.html cv.html

This is especially useful for developers.

Want to learn more about Terminal and the command line? We have many more command lines tricks for those interested.

7 Handy Command Line Tips You Don’t Want to Miss Guide is free?

Starting from: Free
This guide is a free model
Free Trial: May be included, please check on the official site, we mentioned above.
The 7 Handy Command Line Tips You Don’t Want to Miss tutorial price is Free or Freemium. This means you can truly enjoy the 7 Handy Command Line Tips You Don’t Want to Miss guide.

The 7 Handy Command Line Tips You Don’t Want to Miss guide gives you an easy-to-use and efficient management and 7 Handy Command Line Tips You Don’t Want to Miss allows you to focus on the most important things. It’s friendly guide to use maybe you will love it and 7 Handy Command Line Tips You Don’t Want to Miss tutorial can be used on Linux, Windows or android devices.

7 Handy Command Line Tips You Don’t Want to Miss: benefits

  • The 7 Handy Command Line Tips You Don’t Want to Miss tutorial is free .
  • Helps many users follow up with interest in a timely manner.
  • The price of the 7 Handy Command Line Tips You Don’t Want to Miss guide is free.

7 Handy Command Line Tips You Don’t Want to Miss: FAQ

Tutorial Summary: 7 Handy Command Line Tips You Don’t Want to Miss

In this guide, we told you about 7 Handy Command Line Tips You Don’t Want to Miss; please read all steps so that you understand 7 Handy Command Line Tips You Don’t Want to Miss in case if you need any assistance from us, then contact us.

How this tutorial helping you?

So in this guide, we discuss the 7 Handy Command Line Tips You Don’t Want to Miss, which undoubtedly helps you.

What is actual time in which this method complete?

The time to complete the 7 Handy Command Line Tips You Don’t Want to Miss tutorial is 10+ minutes.

What are the supported Device?

Apple

What are the supported Operating system?

mac OS


7 Handy Command Line Tips You Don’t Want to Miss Tutorial: final note

For our visitors: If you have any queries regards the 7 Handy Command Line Tips You Don’t Want to Miss, then please ask us through the comment section below or directly contact us.
Education: This guide or tutorial is just for educational purposes.
Misinformation: If you want to correct any misinformation about the guide “7 Handy Command Line Tips You Don’t Want to Miss”, then kindly contact us.
Want to add an alternate method: If anyone wants to add the more methods to the guide 7 Handy Command Line Tips You Don’t Want to Miss, then kindly contact us.
Our Contact: Kindly use our contact page regards any help. You may also use our social and accounts by following the Whatsapp, Facebook, and Twitter for your questions. We always love to help you. We answer your questions within 24-48 hours (Weekend off).
Channel: If you want the latest software updates and discussion about any software in your pocket, then here is our Telegram channel.

Compsmag