EzDevInfo.com

terminal interview questions

Top terminal frequently asked interview questions

Opening Sublime Text on command line as subl on Mac OS?

.subl returns -bash: .subl: command not found

Anyone know how to open Sublime Text 3 from the command line for mac?


Source: (StackOverflow)

Running script upon login mac [closed]

I am wondering if anyone is able to help me out with getting a .sh file to run when I log in to my account on my computer. I am running Mac OS X 10.6.7.

I have a file "Example.sh" that I want to run when I log onto my computer. I do not have a problem running it when I am already logged in, but I want this to run automatically.

People are saying to add it to the login shell file, but I do not know where that is. Some help please. Thanks in advance


Source: (StackOverflow)

Advertisements

SVN Commit specific files

Is there any way to commit only a list of specific files (e.q. just one of the list of files that SVN wants to commit).

I'm working on MAC OS X under Terminal, without any UI.


Source: (StackOverflow)

Create a symbolic link of Directory in Ubuntu [closed]

Below is my code for creating a symlink of directory:

sudo ln -s /usr/local/nginx/conf/ /etc/nginx

I already created the directory /etc/nginx. I just want the contents of the source directory to be in the contents of the target dir. When I execute the code that is in /etc/nginx is a directory called "conf". In that dir is the contents I want but in the wrong location. So, why did it put a directory in the target folder?


Source: (StackOverflow)

How to get console window width in python

Is there a way in python to programmatically determine the width of the console? I mean the number of characters that fits in one line without wrapping, not the pixel width of the window.

Edit

Looking for a solution that works on Linux


Source: (StackOverflow)

Get current directory name (without full path) in Bash Script

How would I get just the current working directory name in a bash script, or even better, just a terminal command.

pwd gives the full path of the current working directory, e.g. /opt/local/bin but I only want bin


Source: (StackOverflow)

Git says "Warning: Permanently added to the list of known hosts"

Every time I use git to interact with a remote, such as when pulling or pushing, I am shown the following message:

Warning: Permanently added '...' (RSA) to the list of known hosts.

How can I prevent this annoying message from displaying? It is only an annoyance—everything functions properly.


Source: (StackOverflow)

Print in terminal with colors using Python?

How can I output colored text to the terminal, in Python? What is the best Unicode symbol to represent a solid block?


Source: (StackOverflow)

Is there any way in the OS X Terminal to move the cursor word by word? [closed]

I know the combination Ctrl+A to jump to the beginning of the current command, and Ctrl+E to jump to the end.

But is there any way to jump word by word, like Alt+/ in Cocoa applications does?


Source: (StackOverflow)

Sublime Text from Command Line (Win7)

I installed Sublime Text and wanted to know how to open rb files in it from terminal. I saw this thread and I see that I can make Sublime my core editor, but I want to be able to type

sublime file.rb

How do I do this in Win7?


Source: (StackOverflow)

Copying files across computers using SSH and MAC OS X Terminal [closed]

I'm trying to copy my .profile, .rvm and .ssh folders/files to a new computer and I know how to use the cp and ssh commands but I'm not sure how to use them in order to transfer files from one computer to another. Any help would be great, thanks!


Source: (StackOverflow)

How do I clear/delete the current line in terminal?

If I'm using terminal and typing in a line of text for a command, is there hotkey or anyway to clear/delete that line?

For example, if my current line/command is something really long like:

> git log --graph --all --blah..uh oh i want to cancel and clear this line <cursor is here now>

Is there a hotkey or command to go from the above to:

>

?

Usually I will press the down key and if my current line is a brand new one on the history, that will clear it. But if I'm going through my command history via the up key and start editing or using those commands, down will only change the prompt to the next newest command in history, so it doesn't work here unless I press down multiple times.

Thanks!


Source: (StackOverflow)

List Git aliases

How do I print a list of my git aliases, i.e., something analogous to the bash alias command?


Source: (StackOverflow)

How do I output coloured text to a Linux terminal?

How do I print coloured characters to a Linux terminal that supports it? I'm using C++ for this program, but I think that might be irrelevant.

EDIT: And secondly, how do I tell if it supports colour codes?


Source: (StackOverflow)

Linux command to list all available commands and aliases

Is there a Linux command that will list all available commands and aliases for this terminal session?

As if you typed 'a' and pressed tab, but for every letter of the alphabet. Or running 'alias' but also returning commands.

Why? I'd like to run the following and see if a command is available:

ListAllCommands | grep searchstr

Source: (StackOverflow)