Skip to main content

Questions tagged [command-line]

This tag is for questions that are about using the command-line interface (CLI), including the use of standard command-line tools and shell commands. However, for questions that are specific to each shell (like Bash, ZSH etc.), use the tag of that particular shell as well.

Filter by
Sorted by
Tagged with
2208 votes
9 answers
8.0m views

How to unzip a zip file from the Terminal?

Just downloaded a .zip file from the internet. I want to use the terminal to unzip the file. What is the correct way to do this?
ubuntu-nerd's user avatar
  • 22.3k
1468 votes
12 answers
4.5m views

How do I install a .deb file via the command line?

How do I install a .deb file via the command line?
TheXed's user avatar
  • 26.8k
1399 votes
11 answers
4.0m 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.
led-Zepp's user avatar
  • 14.3k
1329 votes
8 answers
4.0m views

How can I copy the contents of a folder to another folder in a different directory using terminal?

I am trying to copy the contents of a folder to another folder in a different directory using terminal. Would somebody be able to provide me an example of the command line syntax required to achieve ...
pandisvezia's user avatar
  • 13.5k
1173 votes
14 answers
1.8m views

How do I determine the total size of a directory (folder) from the command line?

Is there a simple command to display the total aggregate size (disk usage) of all files in a directory (folder)? I have tried these, and they don't do what I want: ls -l, which only displays the ...
David Barry's user avatar
  • 11.8k
1088 votes
10 answers
3.7m views

Is there a command to list all users? Also to add, delete, modify users, in the terminal?

I need a command to list all users as well as commands to add, delete and modify users from terminal - any commands that could help in administrating user accounts easily by terminal.
979 votes
7 answers
3.4m views

How can I add a user as a new sudoer using the command line?

After I add a user using adduser, I can't see it via System > Administration > Users and Groups unless I log out and then log in again. Is that normal? Also, can I set a newly added user as a sudoer ...
David B's user avatar
  • 11.1k
966 votes
5 answers
2.8m views

How do I shut down or reboot from a terminal?

How can I shut down or reboot Ubuntu using terminal commands?
Raja G's user avatar
  • 103k
932 votes
8 answers
2.0m 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?
Jon Doe's user avatar
  • 11.5k
909 votes
9 answers
1.1m views

How can I recursively delete all files of a specific extension in the current directory?

How do I safely delete all files with a specific extension (e.g. .bak) from current directory and all subfolders using one command-line? Simply, I'm afraid to use rm since I used it wrong once and now ...
user216038's user avatar
  • 9,093
884 votes
9 answers
2.3m views

How do I search for available packages from the command-line?

I have successfully installed some packages using the command: sudo apt-get install packagename when I have known in advance that those packages are available. But how can I search for or get a list ...
Mark Thomas's user avatar
  • 8,975
883 votes
9 answers
2.7m views

How to install updates via command line?

When I log into my web server via SSH I see the information: 88 packages can be updated. 80 updates are security updates I tried apt-get update then apt-get upgrade but each time I log in I still ...
Marlin's user avatar
  • 8,984
805 votes
7 answers
3.0m views

How do I rename a directory via the command line?

I have got the directory /home/user/oldname and I want to rename it to /home/user/newname. How can I do this in a terminal?
N.N.'s user avatar
  • 18.3k
789 votes
4 answers
4.2m views

How to delete a non-empty directory in Terminal?

How do I delete the following directory? I typed: rmdir lampp This error comes up: rmdir: failed to remove `lampp': Directory not empty Is there a command to delete all the files in the directory ...
naveen's user avatar
  • 8,117
769 votes
9 answers
3.8m views

Change folder permissions and ownership

I would like the user to have full rights on this folder (as well as all sub-directories and files in it): ~/.blabla currently owned by root. I have found numerous posts (in this forum and ...
user2413's user avatar
  • 14.5k
750 votes
9 answers
2.0m views

What is the correct way to completely remove an application?

I've searched the net for such information and found different command lines, like these ones: sudo apt-get remove application sudo apt-get remove application* sudo apt-get remove --purge ...
user48949's user avatar
  • 7,943
742 votes
16 answers
1.7m views

How to check Internet Speed via Terminal?

Instead of going to sites like speedtest.net, I want to check my current Internet speed from the terminal on Ubuntu. How can I do it?
kernel_panic's user avatar
  • 11.8k
704 votes
9 answers
2.1m views

What does "sudo apt-get update" do?

I am wondering what sudo apt-get update does? What does it update?
Elysium's user avatar
  • 11k
670 votes
8 answers
1.5m views

How can I decode a base64 string from the command line?

I would like to write a bash script to decode a base64 string. For example I type decode QWxhZGRpbjpvcGVuIHNlc2FtZQ== and it prints Aladdin:open sesame and returns to the prompt. So far I have tried ...
lofidevops's user avatar
  • 21.1k
654 votes
9 answers
830k views

How do I check which shell I am using?

I read that terminal is nothing but shell, and Unix provides different flavors of shells: Bourne shell (sh) C shell (csh) TC shell (tcsh) Korn shell (ksh) Bourne Again shell (bash) Questions: When ...
GMudide's user avatar
  • 6,715
634 votes
2 answers
1.3m views

How to redirect stderr to a file [duplicate]

While using nohup to put a command to run in background some of content appear in terminal. cp: error reading ‘/mnt/tt/file.txt’: Input/output error cp: failed to extend ‘/mnt/tt/file.txt’: Input/...
André M. Faria's user avatar
612 votes
7 answers
512k views

Which one is better: using ; or && to execute multiple commands in one line?

In tutorials and how-to's I often see commands combined. For instance, sudo apt-get update && sudo apt-get install pyrenamer There seem to be four possible connectors: &, &&, || ...
don.joey's user avatar
  • 28.8k
600 votes
20 answers
1.2m views

How do I fix my locale issue?

I am getting this message every time I do something like starting or stopping a service. perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: ...
HackToHell's user avatar
  • 6,776
598 votes
25 answers
1.1m views

How to show the transfer progress and speed when copying files with cp?

Otherwise, is there any alternative command line utility that can achieve this?
Olivier Lalonde's user avatar
594 votes
4 answers
1.2m views

How do I check the version of Ubuntu I am running? [duplicate]

How can I check my current Ubuntu version through the command-line and GUI?
LMatt's user avatar
  • 5,965
582 votes
3 answers
1.6m views

How do I use variables in a sed command?

I tried the following code to replace QQ with ZZ, but it doesn't do what I want: var1=QQ sed -i 's/$var1/ZZ/g' $file However, this code does what I want: sed -i 's/QQ/ZZ/g' $file How do I use ...
UAdapter's user avatar
  • 17.7k
577 votes
2 answers
737k views

How do I retrieve the public key from a SSH private key?

A SSH private key as generated by ssh-keygen contains a public key part. How do I retrieve this public key from the private key? I've lost my public key and need to put the contents of this public key ...
Lekensteyn's user avatar
  • 175k
556 votes
6 answers
419k views

How to see the command attached to a bash alias?

Suppose I have an alias in the bash shell. Is there a simple command to print out what command the alias will run?
Casebash's user avatar
  • 5,819
546 votes
11 answers
887k views

How to list all variables names and their current values?

How to list all variables names and their current values? Including not only $HOME, $PWD etc but any other you have defined.
Strapakowsky's user avatar
539 votes
13 answers
1.1m views

Execute sudo without Password?

Inspired by this question.... I am the sole person using my system with 12.04. Every time I issue a sudo command; the system asks for the user password (which is good in its own way). However I was ...
BhaveshDiwan's user avatar
  • 11.1k
538 votes
12 answers
909k 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 ...
Stann's user avatar
  • 15.2k
513 votes
7 answers
522k views

How can I get octal file permissions from command line?

There is a chmod command to set file permissions, but can I get file permissions in octal mode (such as 755) from the command line?
Anwar's user avatar
  • 76.9k
507 votes
17 answers
4.4m views

How do I run .sh scripts?

Whenever I open a .sh file, it opens it in gedit instead of the terminal. I can't find any option similar to Right Click → Open With → Other Application... → Terminal. How do I open this file in the ...
Alex's user avatar
  • 5,071
502 votes
8 answers
1.6m views

How to create a bootable Ubuntu USB flash drive from terminal?

Is there any way to create a bootable Ubuntu USB flash drive from the terminal without using any third-party applications like YUMI, Unetbootin, Startup Disk Creator, etc. I tried to create a ...
498 votes
10 answers
1.1m views

How to select video quality from youtube-dl?

I have installed youtube-dl in my 14.04. I can download video by following command, $ youtube-dl [youtube-link] But I want to know how to select available pixel quality of youtube video(i.e 1080p, ...
A J's user avatar
  • 11.4k
498 votes
14 answers
726k views

How can I suspend/hibernate from command line?

How can I suspend or hibernate my laptop using command line, without installing additional software?
user1034's user avatar
  • 4,983
491 votes
12 answers
1.8m views

How to use "grep" command to find text including subdirectories

I want to find all files which contain a specific string of text. The grep command works, but I don't know how to use it for every directory (I can only do it for my current directory). I tried ...
Smile.Hunter's user avatar
  • 8,395
491 votes
5 answers
1.1m views

What do the different colors mean in ls?

What do the different colours in Ubuntu's ls command mean? For example, when I type the ls command in one of my folders, I get one of the files in light green, the other (which is a folder) in blue ...
Rafid's user avatar
  • 5,447
486 votes
2 answers
386k views

Differences between /bin, /sbin, /usr/bin, /usr/sbin, /usr/local/bin, /usr/local/sbin

I have six directories with command files. These are /bin, /sbin, /usr/bin, /usr/sbin, /usr/local/bin and /usr/local/sbin. What are the differences between these? If I'm writing my own scripts, where ...
user avatar
465 votes
12 answers
2.0m 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 ...
Michael's user avatar
  • 4,651
460 votes
9 answers
1.9m views

How to remove all files from a directory?

The closest I've gotten is # rm /path/to/directory/*.* but that doesn't work for files that don't have an extension...
user784637's user avatar
  • 11.1k
455 votes
19 answers
699k views

How do I check the battery's status via the terminal?

I would like a command that displays the battery status in the terminal.
Joe's user avatar
  • 4,551
449 votes
4 answers
1.9m 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?
Ziyaddin Sadygly's user avatar
433 votes
10 answers
464k 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 ...
lovespeed's user avatar
  • 4,481
427 votes
7 answers
958k views

How to download an MP3 track from a YouTube video

There are several Q&A threads that explain how to download youtube videos using the terminal. However, I would also like to learn how to extract the video's soundtracks as MP3 files--also using ...
siraj's user avatar
  • 5,327
407 votes
11 answers
811k 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?
Avinash Raj's user avatar
407 votes
5 answers
738k views

What does 2>/dev/null mean?

I would like a brief explanation of the following command line: grep -i 'abc' content 2>/dev/null
Naive's user avatar
  • 4,835
404 votes
10 answers
453k views

How can I install just security updates from the command line?

sudo apt-get upgrade installs all updates, not just security updates. I know that I can use Update Manager to select only important security updates, but is there a way to do this from the command ...
crenshaw-dev's user avatar
  • 32.1k
404 votes
6 answers
1.6m views

How to download a file from a website via terminal?

Suppose that we have a full URL of desired file e.g. http://domain.com/directory/4?action=AttachFile&do=view&target=file.tgz I would like to go without installing a new software. Is it ...
0x6B6F77616C74's user avatar
401 votes
14 answers
1.4m views

Command line to list DNS servers used by my system

Is there a command to list DNS servers used by my system? I tried $ cat /etc/resolv.conf # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY ...
Anurag Uniyal's user avatar

1
2 3 4 5
459