EzDevInfo.com

command interview questions

Top command frequently asked interview questions

Where can I find source code for Linux core commands?

I'd like to read the actual code which the linux commands are written with. I've gained some experience using them and now I think it's time to interact with my machine at a deeper level. I've found some commands here http://directory.fsf.org/wiki/GNU.

Unfortunately I wasn't able to find basic commands such as 'ls' which seems to me easy enough to begin.

Do you happen to know some web page, book or any other stuff to begin?

I'm running on Ubuntu 12.04


Source: (StackOverflow)

What is that "total" in the very first line after ls -l?

What is that "total" in the output of ls -l?

    $ ls -l /etc
    total 3344
    -rw-r--r--   1 root root   15276 Oct  5  2004 a2ps.cfg
    -rw-r--r--   1 root root    2562 Oct  5  2004 a2ps-site.cfg
    drwxr-xr-x   4 root root    4096 Feb  2  2007 acpi
    -rw-r--r--   1 root root      48 Feb  8  2008 adjtime
    drwxr-xr-x   4 root root    4096 Feb  2  2007 alchemist

Source: (StackOverflow)

Advertisements

What is the difference between git clone and checkout?

What is the difference between git clone and git checkout?


Source: (StackOverflow)

How can you run a command in bash over until success

I have a script and want to ask the user for some information, the script cannot continue until the user fills in this information. The following is my attempt at putting a command into a loop to achieve this but it doesn't work for some reason.

echo "Please change password"
while passwd
do
echo "Try again"
done

I have tried many variations of the while loop:

while `passwd`
while [[ "`passwd`" -gt 0 ]]
while [ `passwd` -ne 0 ]]
# ... And much more

But I can't seem to get it to work.


Source: (StackOverflow)

Calling an external command in Python

How can I call an external command (as if I'd typed it at the Unix shell or Windows command prompt) from within a Python script?


Source: (StackOverflow)

What is the difference between the remap, noremap, nnoremap and vnoremap mapping commands in vim?

What is the difference between the remap, noremap, nnoremap and vnoremap mapping commands in vim?


Source: (StackOverflow)

How do I ignore files in Subversion?

How do I ignore files in Subversion?

Also, how do I find files which are not under version control?


Source: (StackOverflow)

Run Command Prompt Commands

Is there any way to run command prompt commands from within a C# application? If so how would I do the following:

copy /b Image1.jpg + Archive.rar Image2.jpg

This basically embeds an RAR file within JPG image. I was just wondering if there was a way to do this automatically in C#. Thank you.


Source: (StackOverflow)

Equivalent of *Nix 'which' command in Powershell?

Does anyone know how to ask powershell where something is?
For instance "which notepad" and it returns the directory where the notepad.exe is run from according to the current paths.


Source: (StackOverflow)

Passing an enum value as command parameter from XAML

I want to pass an enum value as command parameter in WPF, using something like this:

<Button 
    x:Name="uxSearchButton" 
    Command="{Binding Path=SearchMembersCommand}" 
    CommandParameter="SearchPageType.First"
    Content="Search">
</Button>

SearchPageType is an enum and this is to know from which button search command is invoked.

Is this possible in WPF, or how can you pass an enum value as command parameter?


Source: (StackOverflow)

How can I recall the argument of the previous bash command?

Is there a way in Bash to recall the argument of the previous command?

I usually do vi file.c followed by gcc file.c.

Is there a way in Bash to recall the argument of the previous command?


Source: (StackOverflow)

VIM - multiple commands on same line

I've been trying to find something that will let me run multiple commands on the same line in vim, akin to using semicolons to separate commands in *nix systems or & in windows. Is there a way to do this?


Source: (StackOverflow)

What is a unix command for deleting the first N characters of a line?

For example, I might want to:

tail -f logfile | grep org.springframework | <command to remove first N characters>

I was thinking that tr might have the ability to do this but I'm not sure.


Source: (StackOverflow)

IntelliJ IDEA disable font increase/decrease on CMD+scroll

I am using IntelliJ IDEA 9.0.2 on Mac OS X - with the Magic Mouse. Whenever I press the command button and move my finger a micrometer or two on the surface of the mouse, IDEA immediately increases or decreases my font size rapidly. How can I disable this feature?


Source: (StackOverflow)

How to get a unix script to run every 15 seconds?

I've seen a few solutions, including watch and simply running a looping (and sleeping) script in the background, but nothing has been ideal.

I have a script that needs to run every 15 seconds, and since cron won't support seconds, I'm left to figuring out something else.

What's the most robust and efficient way to run a script every 15 seconds on unix? The script needs to also run after a reboot.


Source: (StackOverflow)