Questions tagged [command-line]

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

Filter by
Sorted by
Tagged with
263
votes
9answers
1.1m 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 ...
260
votes
11answers
515k views

How can I view the contents of tar.gz file without extracting from the command-line?

I want to see the contents (list of files and folders) of an archive, for example a tar.gz file without extracting it. Are there any methods for doing that?
259
votes
3answers
1.1m views

How to make a file (e.g. a .sh script) executable, so it can be run from a terminal

I have a script.sh file and type of this file is shellscript file. I want to make this file as application/x-executable file. How can I make it?
258
votes
7answers
541k views

How do I find the kernel version, Ubuntu release and disk partition information from the terminal?

Which commands will give me information about following using Terminal? Kernel Version Distribution version no. All partition size of the HDD
258
votes
6answers
655k views

How to restart X Window Server from command line?

How can I restart X Window Server from the command line? I'd really like to be able to restart my GUI without having to do a full system reboot.
257
votes
4answers
622k views

Run a shell script as another user that has no password

I would like to run a script from the main ubuntu shell as a different user that has no password. I have full sudo privileges, so I tried this: sudo su -c "Your command right here" -s /bin/sh ...
256
votes
6answers
1.3m views

How to access a usb flash drive from the terminal?

I only have access to the command line. I need to backup my data (on the user folder) to a pen (USB DOK). How can I mount a flash drive manually? What should be the copy command?
253
votes
16answers
623k views

How can you log out via the terminal?

Is there a terminal command that will log you out of your current desktop session and take you back to the login screen?
250
votes
5answers
470k views

How can I empty the trash using terminal?

I am not able to search trash anywhere. Can you please tell me a command or anything like that to empty the trash using terminal ?
250
votes
8answers
518k 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 () { ...
250
votes
8answers
267k views

Convert a directory of JPEG files to a single PDF document

I have many JPEG files in a directory, and I want to convert them to PDF and concatenate them together to make a single document. How can this be done? I would prefer using the command line, as ...
242
votes
14answers
333k views

How to easily resize images via command-line?

I would like to know how to resize images in Ubuntu. What is the easiest tool to do so?
232
votes
10answers
20k views

Terminal 'incognito mode'?

I use Terminal a lot, and sometimes I am running commands, which aren't things I don't want others to see, but more commands that if I accidentally arrowed up to and accidentally executed would cause ...
230
votes
10answers
371k 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 time-zones. If I wanted to change the time-zone to EST and GMT, what do I need to do?
230
votes
14answers
369k views

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

I know how to list all packages installed on my system. But how could I get a list of all repositories and PPA's into a script that I can run on a new machine to replicate the repository setup ...
226
votes
8answers
835k views

How can I create a zip archive of a whole directory via terminal without hidden files?

I have a project with lots of hidden folders / files in it. I want to create a zip-archive of it, but in the archive shouldn't be any hidden folders / files. If files in a hidden folder are not ...
220
votes
14answers
609k views

How to send mail from the command line?

How to send mail from the command line?
219
votes
10answers
188k views

What is the difference between Terminal, Console, Shell, and Command Line?

What is the difference between Terminal, Console, Shell, and Command Line?
217
votes
6answers
186k views

How to list dependent packages (reverse dependencies)?

In order to research what caused the installation of a given package, I'd like to get a list of packages which depend on that package. I couldn't find anything obvious in man dpkg.
214
votes
7answers
23k views

How can I make my shell prompt look like a cheeseburger?

I want my shell prompt to look like a cheeseburger! 🍔🍔🍔 It would be nice if it also displayed: username, hostname, and current directory.
209
votes
12answers
306k views

What's a command line way to find large files/directories to remove and free up space?

Looking for a series of commands that will show me the largest files on a drive.
202
votes
1answer
216k views

How do I remove an alias?

I want to remove gs alias from my PC. When I type gs it will open GhostScript. But I checked everywhere in the home directory .alias .bash_aliases .bashrc I also overwrite the gs with my custom ...
198
votes
10answers
227k 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"?
198
votes
6answers
736k views

How to create an empty file from command line

How can I create an empty file from the command line?
194
votes
8answers
409k views

How to get the MD5 hash of a string directly in the terminal?

How do I get the MD5 hash of a string directly from the terminal? For example, I want the string abcdefg hashed. Currently the md5sum command only accepts a filename as input. I want to simply enter ...
193
votes
3answers
741k views

How to unzip .tgz file using the terminal?

I've downloaded mongodb-linux-x86_64-2.6.3.tgz file using windows 7 and kept it on D:\Amra\Software\Developing Soft location. When I right click this .tgz file using Ubuntu and see property it shows ...
193
votes
8answers
869k views

Find a file by name using command-line

I would like to determine the location of a file using command-line. I have tried: find . -type f -name "postgis-2.0.0" and locate postgis-2.0.0 to no avail. What is the command to determine the ...
192
votes
5answers
403k views

How to create a permanent “alias”? [duplicate]

If you create an alias for example: alias cls="clear" It exists untill you kill terminall session. When you start a new terminal window the alias doesn't exist any more. How to create "permanent" ...
190
votes
3answers
298k views

How to exclude multiple directories with rsync?

I am trying to backup my home directory using rsync, and I want to exclude some of the directories that contain junk. I want to specifically exclude /home/ben/.ccache and /home/ben/build. ...
185
votes
4answers
325k views

How can I find my User ID (UID) from terminal?

The title says it all. What command I need to run from a terminal to find my user ID (UID)?
185
votes
3answers
119k views

How to open file with default application from command line?

In Nautilus, when you double click a file, it will open it with the default application associated with the file's extension. For instance, .html files will open in a web browser and .pdf will be ...
184
votes
7answers
1.6m views

How to install Chrome browser properly via command line?

I am trying to install chrome browser via command line. I tried this: $ apt-cache search chrome browser The results show that the proper term is "chrome-browser," so I tried that: $ sudo apt-get ...
184
votes
7answers
331k views

How do I change the color for directories with ls in the console?

On my console the color for directories is such a blue, that it is hard to read on a dark background. How can I change the color definitions for ls?
182
votes
13answers
634k views

How to open a PDF file from terminal?

I used to work on the Mac terminal before and I used: open file2open.pdf and the PDF file would be opened on preview or whatever my default viewer was. When I use it in the terminal in Ubuntu I get ...
177
votes
13answers
201k views

How to change Gnome-Terminal title?

I have several instances of terminals running in my working environment, what I would like is to set a specific title for each one, in order to have a clear idea what purpose the specific terminal ...
176
votes
6answers
194k 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 more ...
176
votes
3answers
42k views

Why is a virtual terminal “virtual”, and what/why/where is the “real” terminal?

I hope the question is self-explanatory. My understanding is that gnome-terminal and konsole are virtual terminals, and they are basically serving the same purpose, i.e. a command line environment ...
174
votes
1answer
213k 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 ...
173
votes
4answers
72k views

How do I diff the output of two commands?

I had imagined the simplest way to compare the contents of two similar directories would be something like diff `ls old` `ls new` But I see why this doesn't work; diff is being handed a big long ...
169
votes
21answers
762k views

How to get the GPU info?

I'm looking for a command that would give me the same info as: cat /proc/cpuinfo Except for the GPU (type of the chip and memory, frequency).
169
votes
7answers
336k views

What is the command to run System Settings from a terminal?

System Settings can be run from the launcher (pinned by default), the Dash, or the power cog. But what command would I enter in a terminal window if I want to run it from there?
168
votes
9answers
17k 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 ...
168
votes
6answers
206k views

How can I measure the execution time of a terminal process?

I'm trying to measure the execution time of a process that I call via the command line (i.e., I want to find out how long it takes to for the process to finish). Is there any command that I can add to ...
167
votes
14answers
292k views

How to change LCD brightness from command line (or via script)?

To work around bug #1005495 (changing LCD brightness via hotkeys impossible), I'd like to have one command line query for increasing and one for reducing the brightness of my LCD. I could then map a ...
167
votes
4answers
148k views

apt-get stuck at 0 [Connecting to us.archive.ubuntu.com]

When I do upgrade it gets stuck here: user@plato:~# sudo apt-get upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done ...
167
votes
16answers
409k views

How do you reset a USB device from the command line?

Is it possible to reset the connection of a USB device, without physically disconnecting/connecting from the PC? Specifically, my device is a digital camera. I'm using gphoto2, but lately I get "...
163
votes
6answers
240k views

How do I find the version of bash I am running?

(learning bash) I was trying to check the bash version so I typed /bin/bash -v. That outputted a whole lot of text to the screen (contents of .bashrc, and other files sourced from it). Could I have ...
162
votes
5answers
414k 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, ...