Skip to content

Instantly share code, notes, and snippets.

@eterekhin
Last active November 16, 2022 09:02
Show Gist options
  • Save eterekhin/c2f71d77832a46848ad69d81ae664bca to your computer and use it in GitHub Desktop.
Save eterekhin/c2f71d77832a46848ad69d81ae664bca to your computer and use it in GitHub Desktop.
LINUX_1

How to play around:

Having docker installed run

docker run -it ubuntu:22.04

After this command you'll get working no-frills ubuntu shell

So, now let's play around it

First of all I want to explore which utils are available in /bin directory. So let's execute ls /bin. We'll see bunch of utils. Also you can check out /usr/bin directory because it also provides some utils to work with (why do we need both with file-duplicates?)

For beginning I want to add my own util and call it wherever in file system tree I stay

  echo "echo hello world!" > /bin/my_util && chmod +x /bin/my_util && my_util

Now you can go wherever you want and run my_util command which will print "hello world!" message

Now you can note that content of /bin/my_util looks like a human-readable string. Let's create an C program and compile it to check if it works the same TODO::

gcc, file, objdump commands are unavailable, so consider installing them via (binutils provides objdump util):

  apt update &&
  apt install gcc file make binutils vim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment