Jump to content

unix commands

Zygizz

I don't if I in the right section of the forum but didn't find any more relatable. btw its my class question :D

 

a binary file snippet is given i fragmentas.txt and i need to find which 5 files contains this binary fragment.

 

its giving me headache last 2 hours... help guys :D 

Link to comment
Share on other sites

Link to post
Share on other sites

If I understand the problem correctly, you have a file 'fragmentas.txt' which contains some data, and you want to know which other files contain the same data.

awk -v a=`cat fragmentas.txt` '$1 == a { print FILENAME }' ./*

 

Link to comment
Share on other sites

Link to post
Share on other sites

11 hours ago, mshaugh said:

If I understand the problem correctly, you have a file 'fragmentas.txt' which contains some data, and you want to know which other files contain the same data.


awk -v a=`cat fragmentas.txt` '$1 == a { print FILENAME }' ./*

 

yead i have binary file fragmentas i need to determined witch of 3 files contains same data but files from diferent location 

 

/bin/bash

/bin/git-upload-pack

/bin/nvidia-settings

Link to comment
Share on other sites

Link to post
Share on other sites

On 2/24/2019 at 11:18 AM, Zygizz said:

/bin/bash

Probably relevant: You want Linux commands, not Unix commands. Those are not the same thing, even although they are remotely similar in certain aspects.

Write in C.

Link to comment
Share on other sites

Link to post
Share on other sites

5 hours ago, Dat Guy said:

Probably relevant: You want Linux commands, not Unix commands. Those are not the same thing, even although they are remotely similar in certain aspects.

Huh? Linux is a UNIX clone. Its terminal commands are also a clone of Unix commands. 

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

GNU tools are very different from Unix tools. For example, GNU sed is mostly incompatible with Unix sed.

Write in C.

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Dat Guy said:

GNU tools are very different from Unix tools. For example, GNU sed is mostly incompatible with Unix sed.

Give me an example of an universal Unix command whose sythax is wholly different on Linux. 

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

Some don't even exist on Linux, for example: ed and vi aren't installed in Gentoo by default.

 

Furthermore, sed.

Write in C.

Link to comment
Share on other sites

Link to post
Share on other sites

27 minutes ago, Dat Guy said:

Some don't even exist on Linux, for example: ed and vi aren't installed in Gentoo by default.

 

Furthermore, sed.

Gentoo doesn't even have Linux kernel installed by default until you actually compile it. Bad example. 

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

37 minutes ago, wasab said:

Huh? Linux is a UNIX clone. Its terminal commands are also a clone of Unix commands. 

You're confusing POSIX compliance with API equivalence.

In POSIX group parlance, most UNIX distros are "strictly POSIX compliant" while most Linux distros (and the kernel itself) are "POSIX Conformant".

The difference is more than semantic:

  • POSIX conformance is equatable to the phrase "similar in feel"
  • Strictly POSIX compliant means that a program that is also strictly POSIX compliant is guaranteed to
    run on a different strictly POSIX compliant OS without any changes to the source code.

Neither POSIX compliance nor POSIX conformance indicates that any two OSs use the same binary interface.

For example, for the C language operability portion of POSIX, c99, lex, and yacc are required. Linux has no "c99" utility, rather it uses GCC. Most linux distros also don't include the Fort77 Fortran compiler utility, required for strict POSIX compliance.

For a list of POSIX required (Unix) commands and utlities, straight from the horses mouth:
http://pubs.opengroup.org/onlinepubs/9699919799/

 

Be aware that, as the Linux kernel is only POSIX conformant, and most distros are even less so, commands available in strict POSIX are often not available in various distros, and vise versa. There isn't even a requirement that two Linux distros provide the same utilities. Some don't even use the same shell language...
 

ENCRYPTION IS NOT A CRIME

Link to comment
Share on other sites

Link to post
Share on other sites

5 minutes ago, straight_stewie said:

You're confusing POSIX compliance with API equivalence.

In POSIX group parlance, most UNIX distros are "strictly POSIX compliant" while most Linux distros (and the kernel itself) are "POSIX Conformant".

The difference is more than semantic:

  • POSIX conformance is equatable to the phrase "similar in feel"
  • Strictly POSIX compliant means that a program that is also strictly POSIX compliant is guaranteed to
    run on a different strictly POSIX compliant OS without any changes to the source code.

Neither POSIX compliance nor POSIX conformance indicates that any two OSs use the same binary interface.

For example, for the C language operability portion of POSIX, c99, lex, and yacc are required. Linux has no "c99" utility, rather it uses GCC. Most linux distros also don't include the Fort77 Fortran compiler utility, required for strict POSIX compliance.

For a list of POSIX required (Unix) commands and utlities, straight from the horses mouth:
http://pubs.opengroup.org/onlinepubs/9699919799/

 

Be aware that, as the Linux kernel is only POSIX conformant, and most distros are even less so, commands available in strict POSIX are often not available in various distros, and vise versa.
 

I was talking about terminal commands. He mention Gentoo lack some Unix commands. I pointed out gentoo is compiled modular system and nothing will be there until you actually build the packages you want. My point stands. If I don't want things like ls or grep, I am pretty sure I can exclude these binaries all together in any Linux system. 

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

8 minutes ago, wasab said:

I was talking about terminal commands

"terminal commands" is equivalent to "system utilities + shell language".

Ergo, if two operating systems don't share the same set of system utilities and use the same shell language, then the set of "terminal commands" is different between the two operating systems, even if there is some overlap.

Linux distros aren't even guaranteed to use the same shell language as other Linux distros or any UNIX distro [RHEL vs. Debian and RHEL vs. POSIX, as obvious examples], so to make the blanket statement that "all UNIX commands are available on all Linux platforms", which is what you're trying to say, is simply false.

 

ENCRYPTION IS NOT A CRIME

Link to comment
Share on other sites

Link to post
Share on other sites

3 minutes ago, straight_stewie said:

"terminal commands" is equivalent to "system utilities + shell language".

Ergo, if two operating systems don't share the same set of system utilities and use the same shell language, then the set of "terminal commands" is different between the two operating systems, even if there is some overlap.

Linux distros aren't even guaranteed to use the same shell language as other Linux distros or any UNIX distro [RHEL vs. Debian], so to make the blanket statement that "all UNIX commands are available on all Linux platforms", which is what you're trying to say, is simply false.

 

I wasn't talking about shell scripts. He mentioned learning Linux terminal skills doesn't transfer over to Unix terminal. That is absolutely false. Chances are of you are a Linux terminal hacker, you can hack your way through macOS terminal or any Unix terminal as well. 

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

6 minutes ago, wasab said:

Chances are of you are a Linux terminal hacker, you can hack your way through macOS terminal or any Unix terminal as well

Well that part is true enough, learning those skills even applies to PowerShell and DOS though, so I'm failing to see your point.

The thread is about which command to use to accomplish a given task. You made the claim that all Unix commands are available on all Linux platforms when you said:

Quote

Huh? Linux is a UNIX clone. Its terminal commands are also a clone of Unix commands. 

That is simply false. I mean, I don't know what else I can do to convince you of that then point you towards the POSIX standard, which I've already done.

Linux is not a UNIX clone. Linux is "Unix like."

ENCRYPTION IS NOT A CRIME

Link to comment
Share on other sites

Link to post
Share on other sites

8 minutes ago, straight_stewie said:

Well that part is true enough, learning those skills even applies to PowerShell and DOS though, so I'm failing to see your point.

The thread is about which command to use to accomplish a given task. You made the claim that all Unix commands are available on all Linux platforms when you said:

That is simply false. I mean, I don't know what else I can do to convince you of that then point you towards the POSIX standard, which I've already done.

Linux is not a UNIX clone. Linux is "Unix like."

Not true. ls on Windows do not work like Unix at all. 

 

I never said all Unix commands work on Linux. I simply say those which are universal do. You are not gonna see macOS homebrew on  Solaris or Linux apt on non Debian distro. What is universal however such as ls, cp, mv, rm ect all work the same and so is the basic techniques like piping.

 

"Probably relevant: You want Linux commands, not Unix commands...."

this statement has no meaning. Unix terminal and Linux terminal are nearly synonymous. 

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

4 minutes ago, wasab said:

Not true. ls on Windows do not work like Unix at all. 

Sure they do. The shell language in each has commands for finding files, navigating file structures, modifying the file structure, modifying access permissions, checking out the local network... The list goes on and on. Both DOS and BASH shells also have mechanisms where users can write additional utilities and have them be used like built in commands.

 

 

7 minutes ago, wasab said:

never said all Unix commands work on Linux. I simply say those which are universal do.

No, you didn't. You said:

1 hour ago, wasab said:

Huh? Linux is a UNIX clone. Its terminal commands are also a clone of Unix commands. 

The definition of "clone" is: "one that is a copy of an original form".

For your reference, that phrase is false because not all UNIX utilities appear on Linux and not all Linux utilities appear on UNIX. Therefore neither is a copy of the other.

Linux "feels like" UNIX. It is not UNIX, nor is it in any way a copy of UNIX. Maybe in the beginning they were close enough to be called "clones", but that hasn't been true for at least the last decade.

ENCRYPTION IS NOT A CRIME

Link to comment
Share on other sites

Link to post
Share on other sites

30 minutes ago, straight_stewie said:

Sure they do. The shell language in each has commands for finding files, navigating file structures, modifying the file structure, modifying access permissions, checking out the local network... The list goes on and on. Both DOS and BASH shells also have mechanisms where users can write additional utilities and have them be used like built in commands.

1

please stop. you do not know what you are talking about at this point, If you do not believe me, type "ls -lR > output.txt" in both powershell and linux/unix terminal and see what happens

 

30 minutes ago, straight_stewie said:



For your reference, that phrase is false because not all UNIX utilities appear on Linux and not all Linux utilities appear on UNIX. Therefore neither is a copy of the other.
 

 

you are now rigorously interpreting, or rather misinterpreting, my posts. "Clone" means their terminal is synonyms, jsut as BSD terminals are synonyms with both linux and unix terminals. 

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

3 minutes ago, wasab said:

you are now rigorously interpreting

Get's mad that readers apply definitions to words.

Well, guess I'll let you win on that one. As long as you can redefine words to change what you meant on a whim then I can't win a debate against you.

ENCRYPTION IS NOT A CRIME

Link to comment
Share on other sites

Link to post
Share on other sites

4 minutes ago, straight_stewie said:

Get's mad that readers apply definitions to words.

Well, guess I'll let you win on that one. As long as you can redefine words to change what you meant on a whim then I can't win a debate against you.

I did not redefine. Linux is a unix clone is a common description. it is valid and widely accepted by many. You are the one whos twisting it into something it isnt. 

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×