!id # shows who your are in that machine
!whoami # Confirm who am i
import os
cmd = "find / -type f"
os.system(cmd)
# Save a bash command in variable and execute it with the os libraries
# this will run as a bash command
!find / -type f # List all the files from the root directory
/usr/local/lib/python3.7/dist-packages/gensim/downloader.py /usr/local/lib/python3.7/dist-packages/gensim/init.py /usr/local/lib/python3.7/dist-packages/google_cloud_bigquery-1.21.0-py3.6-nspkg.pth /usr/local/lib/python3.7/dist-packages/pyviz_comms/labextension/static/747.872484f6c86b06b5c3f4.js /usr/local/lib/python3.7/dist-packages/pyviz_comms/labextension/static/remoteEntry.df174daebca173550cf8.js /usr/local/lib/python3.7/dist-packages/pyviz_comms/labextension/static/445.e0d338852f1bcbe1aa57.js
!find / -type d -iname "bin" # print all the bin file from the root directory
/usr/lib/llvm-6.0/bin /usr/lib/qt5/bin /usr/lib/jvm/java-11-openjdk-amd64/bin /usr/src/linux-headers-4.15.0-192/tools/testing/selftests/rcutorture/bin /usr/local/bin /usr/local/lib/python3.7/dist-packages/cmake/data/bin /usr/local/lib/python3.7/dist-packages/bin /usr/local/lib/python3.7/dist-packages/caffe2/python/onnx/bin /usr/local/lib/python3.7/dist-packages/torch/bin /usr/local/lib/python3.7/dist-packages/tensorboard_data_server/bin /usr/local/lib/python3.7/dist-packages/prophet/stan_model/cmdstan-2.26.1/bin /usr/local/cuda-10.1/bin
# print all availabe binaries
!ls /bin/*
/bin/bash /bin/hostname /bin/su /bin/bunzip2 /bin/journalctl /bin/sync /bin/bzcat /bin/kill /bin/systemctl /bin/bzcmp /bin/kmod /bin/systemd /bin/bzdiff /bin/less /bin/systemd-ask-password /bin/bzegrep /bin/lessecho /bin/systemd-escape /bin/bzexe /bin/lessfile /bin/systemd-hwdb /bin/bzfgrep /bin/lesskey /bin/systemd-inhibit /bin/bzgrep /bin/lesspipe /bin/systemd-machine-id-setup /bin/bzip2 /bin/ln /bin/systemd-notify /bin/bzip2recover /bin/login /bin/systemd-sysusers
!grep '' /etc/passwd
root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin bin:x:2:2:bin:/bin:/usr/sbin/nologin sys:x:3:3:sys:/dev:/usr/sbin/nologin sync:x:4:65534:sync:/bin:/bin/sync games:x:5:60:games:/usr/games:/usr/sbin/nologin man:x:6:12:man:/var/cache/man:/usr/sbin/nologin lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
# !grep '' /etc/passwd
# !grep '' -r /etc
files = !grep '' -r /etc
for f in files:
if 'sha' in f: # in the shadow what we intersted in
print(f)
/etc/bash.bashrc:# if [ -f /usr/share/bash-completion/bash_completion ]; then /etc/bash.bashrc:# . /usr/share/bash-completion/bash_completion /etc/bash.bashrc:if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-not-found ]; then /etc/bash.bashrc: elif [ -x /usr/share/command-not-found/command-not-found ]; then /etc/bash.bashrc: /usr/share/command-not-found/command-not-found -- "$1" /etc/skel/.bashrc:# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) /etc/skel/.bashrc:# See /usr/share/doc/bash-doc/examples in the bash-doc package. /etc/skel/.bashrc: if [ -f /usr/share/bash-completion/bash_completion ]; then /etc/skel/.bashrc: . /usr/share/bash-completion/bash_completion /etc/skel/.profile:# see /usr/share/doc/bash/examples/startup-files for examples. /etc/gshadow:root::: /etc/gshadow:daemon::: /etc/gshadow:bin::: /etc/gshadow:sys::: /etc/gshadow:adm::: /etc/gshadow:tty::: /etc/gshadow:disk::: /etc/gshadow:lp::: /etc/gshadow:mail:*::