Linux Basic commands
- $? -> It will give last executed command exit code, any non zero number idicates failure and zero means success.
- !<CMD> -> It executes the last executed command i.e !ls means last excuted ls..The most common use case of this is if we want to execute a large command we can get the history number of the same using history and use !<history number>
- groups -> This command is used to list all the groups which the current user is part of.
- Cat,more and less -> here
- Less command is like more with some additional features
- we cannot navigate back using more if the output is pipped ,we can only navigate back using b when we specify file name
- In more caommand,the file movement options are:
- Enter - to move forward by one line
- Space - to move forward by one screen
- b - to move backward by one screen
- q - to quit
- arrow keys to move horizontally and vertically
- j to move one line forward
- k to move one line backward
We can prefix the above keys with a number to override the default movement. For example, 5 followed by j will take us 5 lines forward.
While scrolling through large files, it’s useful to be able to go back to the start of the file, or to the end of the file, quickly. The g key will take us to the start of the file, and the G key will take us to the end of the file.
Comments
Post a Comment