5 Useful Terminal Commands You Can Use More Than Once [Mac & Linux]







SSH

This can be used to securely remotely login to another device which has remote login enabled. It is commonly used to login to jailbroken iPhones and send files. It is also used to repair computers without a display attached or to make sure they are still working. SSH can also be used to tunnel web traffic.
If you’re on OS X, you must make sure that remote login is turned on in the computer you want to remotely login to. You can do this by going to the Sharing pane in System Preferences, then ticking the “Remote Login” checkbox. Note down the bit in quotes after, “To log in to this computer remotely…”

mac terminal commandsThat’s what you have to type into the terminal to log in to that account on that computer. To login using SSH, simply type:
ssh user@host
Where host is the IP. Then verify that
you want to connect and enter the remote computer’s password. From there, you can issue commands from the Terminal remotely.
For Ubuntu, just install OpenSSH, by using:
sudo apt-get install openssh-server
Then check your IP address by clicking nteworking icon on the menu bar, then clicking “Connection Information”. Check your IP address (not the “broadcast” one) and note it down.
ubuntu terminal commands
To login remotely, type in the same as before.

say [OS X Only]

This is limited to OS X machines. Sorry, Linux users. But for you Mac users, say just makes your Mac speak. You would type in:
say TYPE IN SCRIPT HERE
No quotation marks are needed to enclose the speech or anything. Alternatively, you could first type in say, press return, and then everything you type after that is what the Mac will say. This can be use to make your Mac sing as well, if you type this:
say -v Cellos "TYPE IN SCRIPT HERE"
Just add -v to change the voice to a voice of your choice. This time, you’ll need the quotation marks.

mv + cp

This command is very useful for moving things. But this is easier to do in the file browser, why the CLI? Well, if you put a dot in front of a file with most UNIX-like systems, like Linux and all POSIX-compliant systems, like OS X it hides the file. With OS X, you cannot just add a dot. It doesn’t allow you to. So use the Terminal to hide your top secret project, because mv is also used to rename files. cp can copy files if you want.
mv ~/Desktop/sourcename.txt ~/Documents/destinationname.txt
With Linux, you must put the two locations in single quotes.

cd

To navigate to a location on your Terminal, just type:
cd location
You can also drag the folder to the Terminal window after typing cd  and then press Enter.
ubuntu terminal commands
This shortcut works on both OS X and Linux, though it’s a tiny bit easier on OS X. To navigate to your home folder, just type:
cd

ls

Use ls to see the contents of a directory. First you must cd into the  location. Then just type:
ls
This even allows you to see invisible files. Now, can you see how the last three commands link to each other? Now you can find files you hid. If you forget the filenames exactly, this will help you. Now you can restore the hidden files, using the mv command to remove the dot.
mac terminal commands

Conclusion

What do you think? Have you ever used the command line before? If not, did you find these tools easy to use? What other command line tools can you recommend? Tell us by commenting below!

No comments:

Post a Comment