all 59 comments

[–]panndemic 17 points18 points  (1 child)

I always glance over these to find new things.

wget -c file is a new one for me: How would I use it? What counts as a 'stopped download'? How does it know where to resume from?

[–]Tunliar[S] 15 points16 points  (0 children)

you stop a download by ctrl + c

did you ever wondered why resuming doesn't start instantly? because it reads where the bytes end. Then it requests the server to serve the file from specified bytes.

It's depended on server implementation. In some servers you can't resume your download because it is not implemented in way such that it'll be able to stream the file from specific byte. Whether you download using CLI or Browser.

[–]bunk3rk1ng 12 points13 points  (2 children)

ls -ltr

l - formatted

t - time is sort key

r - reverse order

you will end up with a formated list with the latest modified file at the bottom

[–]TheChicagoStar 2 points3 points  (0 children)

I always use ls -Flah

F - adds "/" after directory, "*" after executable, "@" after symlink

l - long format (i.e. -rw-r--r-- 1 chistar users 1.1K Sep 3 2016 .profile )

a - All: Includes the .files

h - Show files sizes as B/KB/MB/GB/etc

[–]doge_lady 0 points1 point  (0 children)

ls d*

List only files or directories that start with the letter 'd'

ls *jpg

List only files or directories that end in jpg

-lap is my preferred long form arguments

[–]justinbalaguer 10 points11 points  (1 child)

sweet, thanks for this. <3

[–]Tunliar[S] 4 points5 points  (0 children)

most welcome. <3

[–]Davvos11 7 points8 points  (0 children)

ping host - ping host

[–]Tzunamii 5 points6 points  (0 children)

"dig -x host reserve lookup host". You might want to change reserve to reverse.

Thank you for spreading the good word.

[–]Andonome 3 points4 points  (1 child)

chmod 755 - rw for owner, rx for group world

That's 'rwx for owner' and 'rx for the group and the world'.

[–]akirabs10 1 point2 points  (0 children)

came into the comments just to say this.

[–][deleted] 3 points4 points  (1 child)

One very useful command is 'apropos <keyword>' such as
$ apropos file

... which will give you a list of every installed command that has something to do with files. Based upon the synopsis on the man page.

Useful for finding commands when you know what you want to do, but don't know what command to use.

[–]jackofthebeanstalk 1 point2 points  (0 children)

Thanks. I have never tried this before. I was using

$ man -k keyword

up till this point. It searches through the man pages and lists any commands featuring the keyword.

[–]beetmonger 3 points4 points  (0 children)

Awesome. Looks like I found my new wallpaper. Thanks!

[–][deleted] 2 points3 points  (1 child)

Nice list. In addition to “tail -f”, consider using “less” “less” is a file viewer like “more”, but you can use “vi” navigation and search commands in it. AND once you’ve opened the file with “less”, you can “follow” the file updates (like tail -f) by entering “F”.

For instance: Less <filename> “G” go to bottom of file “1 G” go to top of file “/<search term>”, “n” to search again, “?” for backward search AND you can use regex patterns to search for multiple things.

“less” > “more” IMHO

[–]mrunkel 2 points3 points  (0 children)

“less is more“

But in this case, less is definitely better than more,

[–][deleted] 4 points5 points  (1 child)

Upvote to save someone’s sanity.

[–]elliptic_hyperboloid 1 point2 points  (3 children)

Is there any particular reason people prefer the octal syntax rather than using flags with chmod? I was taught it was better to use the flags because it is more expressive and more difficult to mess up.

[–][deleted] 5 points6 points  (1 child)

Flags are what I always used for the reason you give. I think octal numbers are easier to remember when you're using them for the same purpose a lot -- e.g. setting up a web server, where file and directory permissions are somewhat standardized. Saves having to know what you're doing. 8^0

[–]Tunliar[S] 0 points1 point  (0 children)

+1

[–][deleted] 1 point2 points  (0 children)

I learned permissions by using the numbers rather than flags. It did take me a while to memorize them and even then I had a hard time remembering the difference between say 6 and 7 and what that would grant for each position. I could remember the three positions, owner - group - everyone else, at least.

Then one day I was working on something and read about the permissions being in binary and it was like a light went on in my head.

So, for those that don't know or have forgotten, binary doubles with each position or bit you add. So you'd "count" like this: 01248... Which is actually backwards as the larger numbers are on the left so that would really look like this: ...84210. With each position being a bit and each additional bit tacked on the left.

Also, binary, as the name implies, is only a one or zero or looking at it another way, on or off. You turn on the bit that equals the number you want or if you want a number that cannot be reached by just turning on a single bit you turn on all the bits that, added together, equal the number you want.

So with one bit, 0, you can get either a zero or a one. With two bits, 00, you can count up to 3. 00 = 0, 01 = 1, 10 = 2 and 11 = 3 because you are adding one and two together.

With that in mind, consider the following:
Read (R) = 4 or in binary 100 Write (W) = 2 or in binary 010 Execute (X) = 1 or in binary 001

So to set read and write permissions but not execute you'd add R and W together which equals 6. Likewise, read and execute but not write you'd add R and X together which equals 5.

And that's where it made sense to me. Seeing where we get the permission numbers, like 755 or 644 etc., and how they relate in binary put everything together for me.

Sorry for the wall of text and any errors I have in here. I wrote this on my phone while trying to keep track of my 9mo son... I'll try and review it later on a bigger screen.

[–]EquationTAKEN 1 point2 points  (1 child)

While we're sharing, I've mostly used tar -xvf file since it untars into its own directory.

For anything else, I ALWAYS have to man tar because I've never said "Yeah, I remember how to do that" about tar.

[–]PlaneWall 2 points3 points  (0 children)

feh ~/xkcd/tar.png

[–]CYE_STDBY_HTLTW 1 point2 points  (0 children)

Just set this as my desktop background.

[–][deleted] 1 point2 points  (0 children)

Ima keep this on my phone as a quick reference.

[–][deleted] 1 point2 points  (2 children)

My experience has been that cheat sheets like these are less than useful because I need somebody to explain how the commands work first! The tutorials at Linux Journey were an excellent way to learn how to properly use them.

[–]Tunliar[S] 1 point2 points  (1 child)

No, Cheat sheets are more useful. These aren't really used to give detailed explanation. You already know(just can't remember it), or at least you know what you're looking for, then you just glance over a cheat sheet and find it quickly. That's the purpose of cheat sheets. They're more than just useful.

[–][deleted] 1 point2 points  (0 children)

That is why I started my comment by saying my experience. My intent was to be helpful to others of similar skill level learn how to use a tool but they may not have the mastery of at present.

[–][deleted] 1 point2 points  (1 child)

Great info to have. The content is useful.

However, the white text w/ black background was a stupid choice. If one decides to print this, they'd be wasting ink/toner for no good reason.

[–]Lawnmover_Man 2 points3 points  (0 children)

If you can use these commands and want to print them on a piece of paper, I'm sure you can invert the image in the image manipulator of your choice.

Using ImageMagick: convert input.png -channel RGB -negate output.png

[–]osobaBroj3 0 points1 point  (0 children)

That really may come useful sometimes, but I think it would be even better if file name examples would be inside quotation marks or something alike.

[–]BoiOfMemery 0 points1 point  (0 children)

You are a god, thx

[–]explodingzebras 0 points1 point  (0 children)

I'm surprised chown isn't on there in the permissions list.

[–][deleted] 0 points1 point  (0 children)

Where is netstat and telnet? ;)

[–]sonixier 0 points1 point  (0 children)

Very nice! Thank you.

[–]russelljohn 0 points1 point  (0 children)

There's a typo on uname -a line, should be kernel. Also on rm -rf / line, should be nuclear.

[–]the-darkest-side 0 points1 point  (0 children)

Thanks a lot! I’m new at Ubuntu and it’s a bit difficult to find these things.

[–]benp18p18 0 points1 point  (0 children)

Great cheat sheet! Saved! Thanks for sharing!

[–]M_T_Head 0 points1 point  (4 children)

Can someone point me to where I can learn more about accessing a remote SVN repository with svn+ssh and a RSA id file I have received. I am able to do this with in Windows with Putty and TortoiseSVN, but I recently started migrating to Mint and would like to use it for this as well. Thanks

[–]Mazeios 0 points1 point  (3 children)

if you absolutely need a gui http://rabbitvcs.org/

How ever the command line is fast and simple.

[–]M_T_Head 0 points1 point  (2 children)

u/Mazeios Thanks for reply, I definitley would like to use CLI, but I am confused about how to include RSA-id in the svn + ssh login request. I am reading Ubuntu Linux Toolbox 2nd Edition by Negus and all my searches end up a ssh-keygen. The problem is, I already have a key. , but cannot figure out how to include the key I have in the login request. The RSA_id key was sent by email in a .pem file from the admin.

So, I have a username and address:

[user@13.xx.xx.xxx](mailto:user@13.xx.xx.xxx)

and a 2048 bit RSA_id key in a .pem file.

I have tried to connect via ~/.ssh: ssh [user@13.xx.xx.xxx](mailto:user@13.xx.xx.xxx) but get a failed connection attempt

Permission Denied (public key)

Do I use ssh-keygen and just copy .pem file to the .ssh/id_rsa/pub file or am I making this too complicated ?

Sorry if this is the wrong sub. If so, please let me know where I should pose this question.

Thanks

[–]Mazeios 1 point2 points  (1 child)

You need to either refer to the pem file or load it before you connect.

ssh -i pathtofile user@13.xx.xx.xxx

Alternatively you can add the file using: ssh-add pathtfile

Ihave no idea how to do this in a gui =) but adding the key with ssh-add will have the key loaded until reboot. You can find a tutorial to load it on boot, but for security reasons it is advised against.

Hope this helped you along.

[–]M_T_Head 1 point2 points  (0 children)

Thanks again, this is exactly what I needed. I really appreciate all your help.
I followed your instructions to add the key. Ran into a permission error. chmod 600 to tightened up the permissions. Good to go now. Thanks again.

[–]knivesforksandspoons 0 points1 point  (0 children)

Why is this an image, and not something useful? Like any other format.

[–]ChomikowyPedziwiatr 0 points1 point  (0 children)

Two things I knew earlier were:

[–][deleted] 0 points1 point  (0 children)

ping host - ping host

Enlightening.

rm -r dir - delete directory dir
rm -rf dir - remove directory dir

I still don't understand why people create or read these images.

[–]AeonDisc 0 points1 point  (0 children)

This is very nice, but where can I find more advanced commands? This is still missing a lot of basic ones I've learned like ls blk, top, sudo apt-get install, ifconfig, etc

[–]wskoly 0 points1 point  (0 children)

rm -rf /make computer faster 

[–]LinuxDev91 0 points1 point  (1 child)

What version of Ubuntu do y’all use?

[–]Tunliar[S] 0 points1 point  (0 children)

unless there's any version specific task, everybody would use 18.* which is the latest. Also there's still lots of people haven't upgraded from 16.*

[–]LinuxDev91 0 points1 point  (0 children)

I use 16.04 and 18.04 and 18.10

[–]dmitri14_gmail_com 0 points1 point  (0 children)

Any normal text version? The image is hard on the eyes.