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

learn more… | top users | synonyms (5)

9
votes
1answer
1k views

How to run a command or script at screen lock/unlock?

I am looking for a way to store lock/unlock screen times. A=$(date) echo $A >> $HOME/time_xprofile What did I try: $HOME/.bashrc $HOME/.bash_logout $HOME/.bash_prompt $HOME/.xprofile Then ...
6
votes
1answer
1k views

Why is pkexec preferred over gksudo for graphical applications?

Please provide Ubuntu documentation that refutes this: https://help.ubuntu.com/community/RootSudo Why, on my fully updated 13.04 system, does pkexec not function? $ pkexec gedit somefile.txt No ...
74
votes
1answer
50k views

Differences between /bin, /sbin, /usr/bin, /usr/sbin, /usr/local/bin, /usr/local/sbin [duplicate]

I'm running an Ubuntu Server 13.04, but I see the same on a 12.04: I have six directories with command files. These are: /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin What are the ...
70
votes
4answers
90k views

Find and replace text within a file using commands

How can I find and replace specific words in a text file using command line?
58
votes
4answers
71k views

How can I get a list of all repositories and PPAs from the command line?

I know how to list all packages installed on my system. But how could I get a list of all repositories and PPA's? I know I can look into /etc/apt/sources.list and /etc/apt/sources.list.d, but I'm ...
56
votes
5answers
80k views

How to list all variables names and their current values?

Including not only $HOME, $PWD etc but any other you have defined.
39
votes
5answers
45k views

How to add Android Studio to the launcher?

I'm trying to install the android studio so that I can launch it from a launcher instead of via terminal. Can someone give specific instructions please? I think this is something to do with the ...
24
votes
4answers
41k views

How do I save terminal output to a file?

How do I save the output of a command to a file? Is there a way without using any software? I would like to know how.
29
votes
5answers
10k views

How can I change the default text editor from gedit to vim?

How can I change the default text editor from gedit to vim? When I click on a text file, I want it to open in vim under the terminal instead of gedit.
14
votes
2answers
18k views

How do I log all input and output in a terminal session?

How do I keep logs of all the work done via terminal? For example, I want a record of all the work done on database via terminal.
14
votes
3answers
4k views

How to turn off the display via the command line?

Is there a way to turn off the display (enter power saving mode) using a command? For example, when the computer is inactive for a specific interval, the screen turns off to conserve energy. Is there ...
12
votes
5answers
6k views

Why are letters overlapping in the terminal?

I installed Oneiric as a guest OS in VirtualBox using the Mini CD. I installed the ubuntu-desktop package and everything seems to work fine - well, except for a font issue with the terminal: As you ...
16
votes
4answers
8k views

Why is moving directories to /dev/null dangerous?

When trying to move a test_dir directory to /dev/null, I get the message mv: cannot overwrite non-directory ‘/dev/null’ with directory ‘test_dir/’ Then why do people say "Don't run the command sudo ...
11
votes
3answers
17k views

How do I make the terminal run python 3.1?

Currently, when I type "python" at the terminal I get v2.6 which is all fine and dandy but how can I set it to use v3.1 instead? Is there a "path" variable out there somewhere that I can change like ...
6
votes
2answers
15k views

Terminal method of formatting storage drive

I want to know how to format a storage drive from the terminal. Helpful things to provide in the answer would be often used options for commands and base knowledge that one can use to extrapolate ...
23
votes
2answers
4k views

What does `~/ ` mean?

I'm new to Linux and Ubuntu. People keep using ~/filename in their answers to my questions. What does ~/ mean?
5
votes
3answers
11k views

Create a .desktop file that opens and execute a command in a terminal

I would like to know how to write the Exec command of a .desktop file to open a new terminal and execute a shell script in it. The shell script is working and accessible by all users. When launching ...
8
votes
2answers
413 views

What does // mean in a path?

I was working in my terminal, when I misspelled while cd to root (/). Accidentally, I typed // and I got in terminal: root@weblocalhost://# When i type pwd, i get response // but when I type ls -s ...
3
votes
1answer
1k views

Ubuntu Touch using apt-get

I'm sorry if this has already been asked, I did do some searching and didn't find it. However a number of questions, I have just installed the latest Ubuntu touch, on a nexus 5, and was going to have ...
1
vote
2answers
142 views

How to switch to a command-line console [duplicate]

I have just upgraded my system but it boots to Low Graphics mode by default. I have seen questions on how to solve this problem and they all suggest to run a couple of commands from a command-line ...
135
votes
9answers
5k views

How do I delete my commands quickly?

I use terminal for almost all tasks. Let's say I have entered a huge command like this: sudo a-huge-command What is the easiest way to delete the whole command with a single shortcut, rather than ...
82
votes
20answers
10k views

Are there any games which can train people to learn terminal commands? [closed]

It seems to me learning how to use the terminal is a prerequisite to learning how to use Ubuntu. So I'm trying to figure out the best way to learn. Is there a Quizlet online flash card set out there? ...
43
votes
6answers
12k views

What is the difference between ./ and sh to run a script?

I have written a simple script. When I runsh <myscriptname.sh>, i got the correct output, but when I run ./<myscriptname.sh>, I got an error. What is difference between when I do sh and ...
112
votes
9answers
97k views

How to really clear the terminal?

I can issue the clear command or press Ctrl + L to clear the current Ubuntu terminal, but this just shifts previous output upwards and if you use mouse scroll or PgUP and PgDown keys it's hard to ...
46
votes
6answers
95k views

Browsing the internet from the command line

How can I browse the Internet from the command line in Ubuntu?
22
votes
10answers
17k 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.?
36
votes
5answers
44k views

Browse internet inside terminal

Is there any other package other than elinks so that I browse internet inside the terminal using terminal as a browser. I feel elinks is a bit difficult to operate.
43
votes
2answers
49k views

How to get disk usage from command line?

How can I get the current disk usage (in %) of my hard drive from the command line?
20
votes
3answers
11k 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?
26
votes
1answer
33k views

What do the STAT column values in ps mean?

In the STAT column of ps there are a load of letters that don't really make much sense. What do they mean? Here's an example of ps aux | head: USER PID %CPU %MEM VSZ RSS TTY STAT ...
33
votes
1answer
82k views

Command to append line to a text file without opening an editor

Assuming i have a line that i want to add to a file without opening an editor. How could i append this line alias list='ls -cl --group-directories-first' to this file config.fish
26
votes
2answers
1k 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 ?
31
votes
2answers
258k views

How do I open a terminal? [duplicate]

Possible Duplicate: What is a terminal and how do I open and use it? How do I access the Terminal? I just got ubuntu running on my computer and now I am ready to write a program...but I ...
18
votes
7answers
50k views

Create USB installer to install Ubuntu from the command line?

I'm trying to create a bootable USB image to install Ubuntu on a new computer. I have done this before following the "create USB drive" instructions for Ubuntu desktop, but I don't have an Ubuntu ...
15
votes
2answers
11k views

How can I create a custom terminal command (to run a script)?

I'm a web developer. When I want to start working, always i'm executing some command on terminal. For example: sudo service apache2 start sudo service mysql start sublime For speed up this process, ...
21
votes
5answers
3k 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 ?
20
votes
2answers
11k views

How can I hibernate/suspend from the command line and do so at a specific time

I managed to find out how to suspend/hibernate the system from the command line by reading How can I suspend/hibernate from command line?. However, I would like to know how to use the command line to ...
12
votes
2answers
4k views

How to access gvfs mounts from command line?

I have some samba share mounted via Nautilus and I'd like to access the files from command line. They used to appear under $HOME/.gvfs but not any more. Where have they gone to?
22
votes
4answers
7k 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 ...
21
votes
4answers
112k 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 ...
17
votes
6answers
25k views

Home directory not being created

I am trying to understand system administration on Ubuntu. So, as an example, I create a dummy user using sudo useradd -d /home/linda linda and passwd to create the password. I check that an entry ...
15
votes
7answers
16k views

How can I start gnome-terminal at a particular directory?

I've tried gnome-terminal -x 'cd /path/to/dir' and gnome-terminal -e 'cd /path/to/dir' but both give me errors when the new terminal opens. How do I get a new terminal to start in a specific ...
13
votes
1answer
8k views

What commands are needed to install Ubuntu Core?

Ubuntu Core's wiki page page contains the instructions to install Ubuntu Core on a target media: Uncompress (do not unpack) rootfs Format target media: at least one partition should be ext2, ...
13
votes
4answers
415 views

How can I get a list of all packages in a repository section from command line?

In Synaptic, one can list packages by section. For example, in the image below all packages of the "Amateur Radio (universe)" section are listed. How can I get such a list (edit: with package ...
7
votes
2answers
42k views

How to connect to Wired internet connection through terminal?

I am using Ubuntu 10.04 with KDE on it. I am facing a problem in connecting to wired LAN internet connection. Can any one tell me the procedure on how to connect to wired LAN internet connection ...
33
votes
4answers
15k views

Difference between 'dir' and 'ls' terminal commands?

I've been trying to find the difference between using the dir and ls commands in terminal. I know ls is the traditional unix method of viewing the files in a directory, and that dir is the windows ...
14
votes
5answers
136k views

What is a command to compile and run C++ programs?

I am new to Linux. I am using Ubuntu 11.04 and do not know how to compile and execute C++ program in it. I need to know the commands to Compile and Execute a C++ program in Linux.
8
votes
7answers
4k views

how to shift applications from workspace 1 to 2 using command

Is there any way I can switch the application running in one workspace to another on command line? I use Ubuntu 10.04 UPDATE1 As per suggestions below wmctrl -l 0x02200003 -1 bond Bottom ...
7
votes
1answer
528 views

How can I run a command and copy its output?

I've been asked to run a command and copy and paste the output but I have no idea where to start. What do I do?
12
votes
3answers
13k views

How do I resize partitions using command line without using a GUI on a server?

I only access the server via terminal and I can't use graphical tools such as gparted! I need it because I want to create a new partition from a part of root about 768mb to create a swap partition. # ...