Here we use su command to change user in Linux. See man page for su for more details
$ su - userName
We use use env command to see the environment variables. See man page for env for more details
$ env
We use cd command to change directory. See man page for cd for more details
$ cd ~
The following command use OLDPWD environment variable to know the previous working directory.
$ cd -
$ cd /
Here we use scp command to transfer files across hosts. See man page for scp for more details
$ scp user1@host1IPAddr:absolutePath1/fileName user2@host2IPAddr:absolutePath2
$ scp user1@host1IPAddr:absolutePath1/* user2@host2IPAddr:absolutePath2
$ scp -r user1@host1IPAddr:absolutePath1 user2@host2IPAddr:absolutePath2
Here we use find command to find the location/path where a file exists. See man page for find for more details
$ find -name fileName /
$ find -name fileName .
Here we use grep command to search for a string recursively in all files and show it's occurences in files with line numbers. See man page for grep for more details
$ grep -rn "word_to_search" /path
Here we use which command to find the location of the executable used in current environment. which command looks for PATH variable to find the location of the executable used in current environment. See man page for which for more details
$ which python
Here we use whereis command to find the locations of the executable used. where command looks for common Linux locations, PATH, MANPATH variable to find the locations of the executable. See man page for whereis for more details
$ whereis python
Here we use lsb_release command to details of Linux distribution like version. See man page for lsb_release for more details
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Codename: bionic
Here we use file command to get file Information like type, 32 bit/64 bit, processor architecture, stripped (like removal of debug symbols)/unstripped. See man page for file for more details
$ file libc-2.23.so
libc-2.23.so: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, BuildID[sha1]=1ca54a6e0d76188105b12e49fe6b8019bf08803a, for GNU/Linux 2.6.32, stripped
$ file libc-2.23.so
libc-2.23.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-, BuildID[sha1]=9a6b57c7a4f93d7e54e61bccb7df996c8bc58141, for GNU/Linux 2.6.32, stripped
Here we use lsof to know the processes using a file. See man page for lsof for more details
$ lsof /lib/x86_64-linux-gnu/libc-2.23.so
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
systemd 1 root mem REG 253,1 1868984 528009 /lib/x86_64-linux-gnu/libc-2.23.so
systemd-u 283 root mem REG 253,1 1868984 528009 /lib/x86_64-linux-gnu/libc-2.23.so
dhclient 662 root mem REG 253,1 1868984 528009 /lib/x86_64-linux-gnu/libc-2.23.so
Here we use readelf to know the dependent shared objects of a shared object or executable. See man page for readelf for more details
$ readelf -d /bin/ls | grep NEEDED
0x0000000000000001 (NEEDED) Shared library: [libselinux.so.1]
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]