Questions about using the command-line interface (CLI).

learn more… | top users | synonyms (6)

28
votes
2answers
2k views

Write command in one terminal, see result on other one

I want to run a command foo on one terminal and pass the result to another terminal. Is it possible to do this ?
28
votes
4answers
20k views

Shutting down all VirtualBox (vagrant) VMs in one easy to use bash command (that can be put into a bash file)

I use vagrant for development. I forget to shut down a few of the VMs. When I go to log out of my host machine, the Ubuntu shutdown process appears to hang. Might there be a way to script a close of ...
28
votes
5answers
19k views

How to find out the terminal command of an application?

I want to use some applications shown on the Unity Launcher in a terminal, but I need to know the appropriate command to run them. How can I achieve that?
28
votes
2answers
28k views

How to hide terminal output when executing a command?

When I launch certain programs from the command line like eclipse and document viewer in 11.10 it spews a load of information that seems inconsequential. Also when they are run in the background ...
28
votes
5answers
54k views

How can I find out if a specific program is installed? [duplicate]

I want to find out if a program - Chromium for example - is installed on Ubuntu or not. Manually or as a package. How do I know if a program is installed via command line?
28
votes
2answers
24k views

How do I disable the blank console “screensaver” on Ubuntu Server?

How to disable blank screensaver on Ubuntu Server? There's no desktop or X, only console (command-line interface).
27
votes
13answers
2k views

Tips for getting to grips with the command line

When I first migrated from Windows to Ubuntu, by far the most daunting thing I had to do was use the command line. Typing commands is an alien experience when you've only ever been used to pointing ...
27
votes
4answers
46k views

Where to declare environment variables?

What are correct places for: Global environment variables meant to affect all users? User-specific environment variables?
27
votes
8answers
10k views

Multiple terminal windows

I develop code. I use terminal alot. I use many terminal windows alot. I hate how tabs look. Any useful applications that allow for multiple terminal use, and streamline my development. allow me to ...
27
votes
4answers
11k views

What is the purpose of the -9 option in the kill command?

Is there a difference between kill -9 212121 and kill 212121
27
votes
3answers
40k views

How to see time stamps in bash history?

Is there any way I can see at what time the commands were executed from the bash history? We can see the order but is there any way I can get the time also? Bottom-Line: Execution time in the Bash ...
27
votes
4answers
8k views

How can I list all packages I've installed from a particular PPA?

How can I list all packages I've installed from a particular PPA? Command-line answers preferred. Related question: how can I list all installed packages that are not available from the main Ubuntu ...
27
votes
5answers
97k views

How do I move all files from one folder to another using the command line?

I would like to know how could I move all files from a folder to another folder with a command line. Let's say I'm in my Downloads folder and there are a 100 files that I would like to move to my ...
27
votes
2answers
55k views

How do I change mirrors in Ubuntu Server from regional to main?

I have a Lucid Server (10.04) set up and I would like to change the mirror from US (or any other country) to the Main Ubuntu Mirror. For example my two first entries in sources.list are: deb ...
27
votes
2answers
28k views

Extract part of a video with a one-line command

If I have a video, normally avi, but could be any, and I want to create another one in the same format but just a part, the position i seconds to f seconds into the video, what is the one-line command ...
27
votes
4answers
27k views

How to exclude/ignore hidden files and directories in a wildcard-embedded “find” search?

Starting from (notice the wildcards before and after "some text") find . -type f -name '*some text*' how can one exclude/ignore all hidden files and directories? I've already been googling for far ...
27
votes
7answers
31k views

How do I navigate to a samba location I've mounted in Nautilus on the command line?

Please note: I am two weeks old in Linux. I have found a lot of answers to this question on the internet, tried many, but all failed one way or another. Therefore I dare to ask once again in the hope ...
27
votes
5answers
12k views

Switch command output language from native language to english

How can I switch the command output language from my native language to English, so I can post my Ask Ubuntu question with English command output (error messages)?
26
votes
6answers
26k views

How do I change directory to a folder with special characters?

I am using Ubuntu 11.10 and in terminal I want to enter the following folder: cd Milano, Torino (Jan)-Compressed And it does not work! How should I write the command cd to enter this directory?
26
votes
8answers
2k views

How to make a package manager wait if another instance of APT is running?

I have seen many softwares such as Update Manager and Synaptic Package Manager, they wait if some other program is using the /var/lib/dpkg/lock and is locked. How can we do this through the Terminal? ...
26
votes
4answers
49k views

How to change extension of multiple files from command line?

I have many files with .abc extension and want to change them to .edefg How to do this from command line ? EDIT: I have a root folder with many sub-folders, so the solution should work -r ...
26
votes
4answers
5k views

What does ~$ stand for?

What does ~$ stand for? For example: user@ubuntu:~$ So far I know that the $ sign is a symbol for a regular user. If I'm not mistaken root have # at the end. I also found a lot of commands in the ...
26
votes
2answers
5k views

Did I just delete everything with find -exec mv?

I tried to figure this out on my own. Here's the command I used in the terminal: find . -name "*.jpg" -exec mv {} pictures \; I did not create a directory named pictures first. What happened was a ...
26
votes
12answers
20k views

Command line audio players

What are popular audio players for the command line? How to play a single sound file? Are there command line players that also index the music library like Banshee, Exaile, etc.?
26
votes
6answers
6k views

What causes Nautilus to restart whenever I kill it?

In htop, I kill Nautilus, and within one second, it's back, with a new PID! The restarted Nautilus shows in the Processes list, but has no GUI until I manually launch Nautilus... I've heard ...
26
votes
5answers
171k views

How do I remove a folder?

I'm a new user and Im trying to remove a specific folder. I am using sudo rm /path/ but its not working. What is the correct command to use? It is a file catolog I am attempting to remove but im ...
26
votes
3answers
4k views

Why do shells call fork()?

When a process is started from a shell, why does the shell fork itself before executing the process? For example, when the user inputs grep blabla foo, why can't the shell just call exec() on grep ...
25
votes
7answers
25k views

How do I search my command-line history for commands I used before?

Other than viewing the history, is there a way to filter my history? Say I want to search for a command that started with "ssh"?
25
votes
3answers
3k views

Why `time` command doesn't work with any option?

I tried to use time command with -f option to format the output of time, but I get the following error: -f: command not found Then I tried to use other options -a, -o, etc and I get the same error. ...
25
votes
9answers
73k views

How to remove all files and subdirectories in a directory WITHOUT deleting the directory in bash?

Is there a command to remove all files and subdirectories in a directory WITHOUT deleting the directory? For example if I have directory "dontDeleteMe" with subdirectories "1", "2", "3" and each ...
25
votes
2answers
3k views

Prevent command from stopping when pressing CTRL+C

So, I was playing some Zork 1 and I went to copy some text to show a friend of mine, but I accidentally forgot to hold the shift key when pressing CTRL+C. This stopped the command and I lost my Zork ...
25
votes
4answers
13k views

Why is sudo -s better than sudo su?

I’ve seen many comments here in Ask Ubuntu regarding preference in using sudo -s rather than sudo su. For me, that two commands do exactly the same. But why is sudo -s supposed to be better?
25
votes
3answers
16k views

How to print the directory tree in terminal

What is the command that can be used to draw the directory tree inside the terminal emulator?
25
votes
3answers
22k views

Changing colors for user, host, directory information in terminal command prompt

Is it possible to change the colors in the command prompt for the user@computer, as well as the the current directory and command parts of the prompt display? I've already seen something like this ...
25
votes
2answers
20k views

How to edit pdf metadata from command line?

I need a command line tool for editing metadata of pdf-files. I'm using a Aiptek MyNote Premium tablet for writing my notes and minutes on this device, import them later and convert them to pdf ...
25
votes
1answer
22k views

How can I find out what RAM a computer system has?

I'm looking for a way to find out what kind of RAM a system has (clocking speed, DDR-X etc.). Is there a specific command for that? I'm only aware of free or lspci which don't offer those things.
25
votes
3answers
8k views

What is the maximum length of command line arguments in gnome-terminal?

What is the maximum length of command line arguments in gnome-terminal? ... and is there a system environment variable which reports this value?
25
votes
3answers
39k views

How to find and list all the symbolic links created for a particular file?

I had created many symbolic links on various paths for a particular file or a directory. I want the whole list of created symbolic links paths (location). Example: I created symbolic links for ...
24
votes
4answers
3k views

Why wouldn't the `which` command work for `cd`? I can't find the executable for `cd` either!

I tried which cd and it didn't give a path but instead returned the exit code 1 (checked with echo $?). The coreutil cd itself is working, so the executable should be there, right? I also ran a find ...
24
votes
5answers
55k views

Automatically enter input in command line

I'm running a script that it requests entering 'y' on each operation, I am looking for a solution like $ ./script < echo 'yyyyyyyyyyyyyy' to pass all my inputs in one time.
24
votes
4answers
133k views

How can I execute a .jar file from the terminal

I know that to execute a file, I use the . command, then the file name with a space between them. But I'm trying to execute a .jar file using the . and it does not work. I went into the properties and ...
24
votes
6answers
10k views

How can I create an alias for cd and ls?

I frequently run the ls command after running the cd command. How can I create an alias (like cs) for this operation?
24
votes
3answers
22k views

How can I convert a ppt to a pdf from the command line?

I have a folder containing a bunch of ppts, each of which I'd like to convert to an individual pdf. I'm using Ubuntu 10.04 with whatever comes installed on it.
24
votes
5answers
113k views

Create default home directory for existing user in terminal

How do I do this? I created a user without a home directory and now I want to create one. Not just a folder called new_user, I want the default home directory with all it's folders and hidden files, ...
24
votes
4answers
91k views

How to detach a screen on a terminal?

Maybe this is a dumb question. I know how to start a screen or how to list different screens. screen -ls or to attached.. There are screens on: 2477.pts-0.server1 (Detached) ...
24
votes
8answers
29k views

How does one find out the command line corresponding to GUI app (eg, LibreOffice Writer)?

How can I run LibreOffice Writer from the command line? Basically, what is its command and how do I get to know what's the command to run a particular application in general?
24
votes
2answers
12k views

What does “%U” mean when calling a command?

When editing the Applications menu, I see for some applications, their commands have “%U” such as "gedit %U" and "gnome-mplayer %U", but others don't such as "gcalctool". I was wondering What“%U” ...
24
votes
1answer
8k views

How do I pipe terminal standard output (stdout) to the clipboard?

For example, Say I want to list the contents of a folder and directly paste them into a chat window for a friend to see. I realize I could do ls > filename.txt to create a file (filename.txt) ...
24
votes
4answers
44k views

What is the proper terminal-way to shutdown?

I was trying to shutdown my PC through SSH. I executed sudo shutdown now The user was logged-out and Ubuntu starting turning off, but it froze at the last screen with the Ubuntu logo and the loading ...
24
votes
1answer
19k views

Bash: delete word ahead of cursor

Consider the following bash prompt, where ^ denotes the prompt location: svn commit -m very/long/path/to/some/file "[bug 123456] Fix the pixel issue" ^ I'd like to commit a different ...