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

learn more… | top users | synonyms (5)

20
votes
2answers
15k 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 ...
20
votes
2answers
11k views

How to open Nautilus at current command line directory?

I was wondering if anybody knew a command that would allow me to open a Nautilus (if that's the right name for the Ubuntu 12.04 graphic/window explorer) window from the command line at the current ...
20
votes
4answers
3k views

What do “.” and “..” mean when in a folder?

when I used ls -a to view hidden files in folder there were 2 hidden files created by default what is the significance of this two files . and ..? ls -a Produces . ..
20
votes
3answers
179k views

How to start GUI from command line?

I've installed the following version of ubuntu om my machine. ubuntu-12.04-desktop-i386.iso But when I switch on the computer, I get command line. Ubuntu 12.04 LTS COMP-1245 tty1 Once I ...
20
votes
2answers
13k 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).
19
votes
5answers
2k views

Unable to remove a file which has a name like a command argument [duplicate]

I inadvertently created a file called -r in my home directory. Now I cannot get rid of it: rm -rf rm: missing operand Try 'rm --help' for more information. Other attempts: rm /-/r rm: cannot ...
19
votes
3answers
36k views

How to download an MP3 track from a YouTube video [duplicate]

Possible Duplicate: How to download a youtube video via terminal There are several Q&A threads that explain how to download youtube videos using the terminal. However, I would also ...
19
votes
5answers
41k views

How can I make a script that opens terminal windows and executes commands in them?

I have three scripts I need to run when I start up my Ubuntu machine, they start services I use in my development environment. To do that, I manually open three terminals and type in the commands. ...
19
votes
2answers
1k views

How do I run an application with arguments from the command line without losing the terminal?

I use dwm as a window manager on Ubuntu, I like tiled windows and I like them as few as possible. I sometimes need to run an application (let's say it's the pdf viewer mupdf in x11) from the terminal, ...
19
votes
3answers
6k views

How to show ascii art at the top of the terminal when it's opened?

As you can see on this screeshot of Mik's Guake he have a statup message of ascii art when he opens it, and that's what I'd like to do, can someone help me?
19
votes
3answers
16k 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.
19
votes
2answers
816 views

Why does it take so long for Ubuntu to say “command not found”

For some reason, with my setup, it can take Ubuntu several seconds to respond with "command not found" when I accidentally typo a command. Why does it take so long? Is there any way to shorten the ...
19
votes
5answers
899 views

What are shells?

What's a shell, their importance, types and functions?
19
votes
2answers
4k views

How does this [t]ricky bracket expression in grep work?

I saw this one-liner recently: $ ps -ef | grep [f]irefox thorsen 16730 1 1 Jun19 ? 00:27:27 /usr/lib/firefox/firefox ... So it seems to return the list of processes with "firefox" ...
19
votes
1answer
26k views

'sudo su -' vs 'sudo -i' vs 'sudo /bin/bash' - when does it matter which is used, or does it matter at all?

When I'm doing something that requires root be typed in dozens of times in a row, I prefer to switch my session to a root session. In the various tutorials and instructions I have used on the ...
19
votes
3answers
3k views

“♦: command not found” in tty after login

I have this problem after upgrade Lubuntu from 12.10 to 13.04. I press Ctrl + Alt + 1, enter login, password, wait two seconds and get: ♦: command not found". After this message I can type commands ...
19
votes
1answer
13k 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.
19
votes
4answers
2k views

CLI mounting vs. GUI mounting

On Ubuntu 12.10, when I want to mount a hard drive, I can just click on the unmounted drive and everything works fine (by mounting to /media/username/partitionlabel). Basically, I would like to do ...
19
votes
2answers
3k views

How does Middle Click paste work?

I don't understand the middle click paste. Sometimes I highlight text, middle click in the window where I want it to go and it does what I want. Sometimes it doesn't. For instance, when I highlight ...
19
votes
7answers
13k views

How do I toggle sound with amixer?

Including Natty I was always able to toggle (mute/unmute) the 'Master' sound volume with the amixer sset Master toggle command that I linked to an edge binding in CompizConfig-Manager. Now after ...
19
votes
3answers
477 views

Saving output of a grep into a file with colors

I need to save the result of a grep command into a file, but I also want the output file to be formatted and keep the colors just like in the terminal. Is there a way to do that? Maybe make grep save ...
19
votes
3answers
4k views

How to find the number of packages needing update from the command line?

I'm working on some system admin automation using fabric and I'd like to be able to monitor the number of packages that need upgrading on a given machine. This is the same information that I can see ...
19
votes
3answers
6k views

Switch terminal output language from native language to english

How can I switch the terminal output language from my native language to English, so I can post my Ask Ubuntu question with English terminal output (error messages)?
19
votes
1answer
4k 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) ...
19
votes
1answer
37k views

How do I change the language via a terminal?

Using system settings I changed my language to Arabic and deleted the English language from the settings. Then the computer lagged and it logged out - now I can't log back in because the login is in ...
18
votes
5answers
2k views

How to both display a command line's output on console and save the output into a text file?

How can I run sudo apt-get install by BOTH seeing the process of installation (long in my case) and saving its output into a text file ?
18
votes
5answers
6k views

How to open a file manager of the current directory in the terminal?

When I work in terminal, sometimes I want to open the current directory in a GUI file manager. And then to click the items in the window to run the application. How can I do this?
18
votes
4answers
13k views

How do I download the command-line emacs instead of the GUI one?

I used sudo apt-get install emacs to download emacs. I expected the command-line emacs to start when I ran emacs but instead the GUI emacs started. How can I download the command-line emacs?
18
votes
5answers
22k views

How to change time-zone settings from the command line

I have a virtual machine that is set to PST that a couple of colleagues have in different timezones. If I wanted to change the time-zone to EST and GMT, what do I need to do?
18
votes
2answers
9k views

What do the various dpkg flags like 'ii' 'rc' mean?

I frequently need to check which packages are installed, and I use the following command: dpkg -l | grep foo which gives the following output Desired=Unknown/Install/Remove/Purge/Hold | ...
18
votes
3answers
5k views

Is this command to remove old kernels safe to use?

While browsing the internet for Ubuntu articles, I came across this command: sudo dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ...
18
votes
2answers
12k views

How to grep 2 or 3 lines, one containing the text I want, and the others just below it?

This is a snapshot of error log: 06:16:29,933 ERROR EmailRMManager$:45 - Exception In get Message com.rabbitmq.client.AlreadyClosedException: clean connection shutdown; reason: Attempt to use closed ...
18
votes
3answers
982 views

iPython Like Command History For Shell

For those of you who don't do python programming on ubuntu, ipython is a python shell on steroids, but it has this amazing feature that it not only autcompletes based on known names (i.e. the same way ...
18
votes
3answers
3k views

How do I search a PDF file from command line?

I'm checking references of a paper and want to find the positions in the body where some paper (in the references list) is referenced. Is there a PDF editor which supports search via bash and extract ...
18
votes
8answers
20k 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?
18
votes
1answer
5k views

What can I use instead of gnome-open?

What is a current replacement of 'gnome-open' command (generic open of files based on the type)? Before: gnome-open mydoc.pdf # opened PDF in default application Now: gnome-open The program ...
18
votes
5answers
9k views

What's the equivalent to 'explorer .' (Windows) or 'open .' (Mac)?

Inside the terminal, I could use the command 'explorer .' in Win32 or 'open .' in Mac to open GUI explorer/Finder. What's the equivalent command in Ubuntu?
18
votes
2answers
14k views

How can I shorten my command line (bash) prompt?

Currently it is: michael@Castle2012-Ubuntu-laptop01:~/Dropnot/webs/rails_v3/linker/spec/controllers$ Outside of renaming my machine and directory structure... How could I make it be something ...
18
votes
2answers
1k views

How to change number of workspaces from command line?

I'd like to change org.compiz.profiles.unity.plugins.core -> hsize and -> vsize from command line. I thought I could use gsettings set org.compiz.profiles.unity.plugins.core vsize 4 but then ...
18
votes
2answers
15k views

youtube-dl is not working

I am using youtube-dl to download some videos from youtube. But when I write: youtube-dl http://www.youtube.com/watch?v=rn_YodiJO6k I get: [youtube] Setting language [youtube] rn_YodiJO6k: ...
18
votes
2answers
7k 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” ...
18
votes
5answers
4k views

Where are shell/terminal settings stored?

i updated my ubuntu but it crashed during installation and i was not able to recover it (my hard drive crashed). i changed my hard drive and re-install ubuntu i saved all my important docs (bookmark, ...
18
votes
7answers
21k 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 ...
18
votes
3answers
296 views

What is the $BASH_COMMAND variable good for?

According to the Bash manual, the environment variable BASH_COMMAND contains The command currently being executed or about to be executed, unless the shell is executing a command as the result of ...
18
votes
3answers
859 views

Why is the default virtual terminal number 7?

Why is the default virtual terminal in ubuntu tty7? is there any sort of precedent for this, or was that just the number that first came to mind?
17
votes
3answers
3k views

Why doesn't “cd” work in a shell script?

What is wrong with this easy script? I just want to write an script which change my directory: A. I put below commands on the file witch its name is pathABC on the /home/alex directory, #!/bin/sh cd ...
17
votes
3answers
38k views

How to check if a command succeeded?

Is there any way to check if there is an error in executing a command? Example : test1=`sed -i "/:@/c connection.url=jdbc:oracle:thin:@$ip:1521:$dataBase" $search` valid $test1 function valid () { ...
17
votes
2answers
1k views

is there any significance to using tee

Why is it that almost all instructions regarding appending text to system files like fstab and /etc/apt/sources.list.d/<name>.list involve using tee and echo to append said text? Take the ...
17
votes
9answers
41k 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 ...
17
votes
6answers
12k views

Command to see media file info in terminal?

I need a command to quickly see in terminal essential information about an audio or video file. (Then I'll consider adding that to Thunar's custom actions, etc.)