This guide covers the basic understanding of exploration and navigation of linux system.
Find your current path”pwd”.
In order to find out current path, where your are standing.
Just run following command and it will return you the path.
pwd
It should return the following information, if you are standing in users root directory, where developer is the user name.
/home/developer
sdsds
How to get size of a folder?
du -hs <foldername or path>
How to get file(s) name contains certain string “grep”:
Let’s say you need to find file(s) from a folder those contains certian string. Grep will be the tool to solve your problem.
grep -H 'some string' *.csv
If you need to just find string in the file(s)
cat /folder/data.csv | grep 'findme'
You can also multiple grep at a time, take a look at how:
cat /folder/data.csv | grep 'findme' | grep 'findme2'
What will happen now, first grep will search data that contains string findme, the it will search findme2 outof first grep results.
Secure copy “scp”:
scp is a tool to upload or download a file from between local and remote machines.
Download a file from server:
scp user@remoteIP:/remotedirectory/backup/data.csv /home/user/download/
List environment variables “printenv”:
Following tools can be used to list environment veriables.
1. printenv Prints all or part of environment.
2. env Prints all exported environment or run a program in a modified environment.
3. set Prints the name and value of each shell variable.