Skip to content

Tag: command

No man page for the cd command

Ubuntu Linux 15.10 – I just noticed that there is no man page for cd This seems a bit strange. I tried: at the cmd line and I get back I was trying to find documentation on which is super-handy for flipping between the last dir and the current dir and cd — which seems to be an alias for

How to get Linux command location in C?

I am using execv in C, but it demands to get the path of the command to get it executed, For example: To execute ls I must have char* command = “/bin/ls”; To execute gedit I must have char* command = “/usr/bin/gedit”; My question is how to get the string “/bin” or “/u…

Option -l of exec shell command

Could you please clarify on the use of -l option of exec shell command. I didn’t notice any difference when I ran exec ls | cat and exec -l ls | cat. Answer The -l option of exec adds a – at the beginning of the name of your command. For example: Note the – everywhere before diff. The point

Why count differs between ls and ls -l linux command?

I had a directory with number of files and need to check the count of files present in it. I tried the following two commands: and found there are differences while using both commands. (ie. number of files is greater in the usage of second command while comparing to the first command.) I would like to know t…

How do I read the whole command line?

Command $ ls -l | ./main.out The output will show My question is, how do I make my program to read the command before that, ls -l Answer Command line parameters are passed as arguments when calling the program. And your program will read the entire command line arguments. But What you are doing ($ ls -l | ./m…

Running shell script using .env file

I am fairly new to running scripts in UNIX/Linux. I have a .env file containing environment information and a .sh script containing folder creations etc for that environment. How would I run the script on the environment contained in the .env file or how could I point the script to the target environment? Wou…

Linux command How to delete all with .html extension

i am using putty, want to delete all files which having .html extension I am trying the below ways 1st get the file by using find command Listing all files having .html extension now i am going to delete those files OR both are not working for me, anybody know solution Thanks Answer make sure you’re del…

How to kill a process by its pid in linux

I’m new in linux and I’m building a program that receives the name of a process, gets its PID (i have no problem with that part) and then pass the PID to the kill command but its not working. It goes something like this: Can someone tell me why it isn’t killing it ? I know that there are som…