The command-line is the interactive interface to your shell.

learn more… | top users | synonyms (1)

1
vote
1answer
462 views

How to get byobu to start at startup with a command executed, as root?

I want when the computer start, a byobu session is started and a command executed in the first window (windows 0), without requiring any user intervention. It is very important that this doesn't ...
9
votes
11answers
7k views

How can I “cat” a file and remove commented lines?

I'd like to know if there is a way that I could cat file like php.ini and remove all lines starting with ; For example, if the file contained this: ; - Show all errors, except for notices ; ...
2
votes
1answer
31 views

How can I make mailx inform me of new mail?

I'm trying to set up mailx on my server. On one server (Raspbian) I am informed of new mail with a message You have new mail (or something similar). On another machine (Raspbmc), I never have this ...
2
votes
5answers
61 views

Printing specific section of a line when a trigger value is present

I'm parsing data in the following format: prop1=value1:prop2=value2:prop3=value3+prop1=value4:prop2=value5 parts of the string are delimited by + properties can appear in any order the desired ...
13
votes
4answers
3k views

how to download a file using just bash and nothing else (no curl, wget, perl, etc.)

I have a minimal headless *nix which does not have any command line utilities for downloading files (e.g. no curl, wget, etc). I only have bash. How can I download a file? Ideally, I would like a ...
1
vote
3answers
252 views

alternative to nslookup in rhel7?

nslookup does not come preinstalled in RHEL 7 Beta. I noticed even dig and host was not pre installed. I read couple of links which mentions nslookup is dead/deprecated, so is there an alternative for ...
1
vote
1answer
41 views

Memory buffer in a bash script

I have recently finished a script that will ask for a hostname and automatically take the argument of the function and ssh into one of my work servers. Here is a copy of my script: #!/bin/bash echo ...
5
votes
1answer
121 views

Command-line incremental backup tools

Which command line backup tool(s) has the best compression ratio? I want to backup my entire system, including media files, text files etc. I found this list on the Arch wiki site but I don't know ...
38
votes
8answers
21k views

How can I edit multiple files in VIM?

I know I can open multiple files with vim by doing something like vim 2011-12*.log, but how can I switch between files and close the files one at a time? Also, how can I tell the file name of the ...
1
vote
0answers
15 views

Mirrored Linux Commands [duplicate]

I've encountered two incidents where commands (or logic flow) is given forward and backwards In bash scripts: if ... fi (use to closed an if-statement) and in GNU/Linux command line: cat; tac (cat ...
3
votes
2answers
36 views

Copy a folder and its content to all Nginx vhosts host

I am interested to know if a single command line that would allow me to recursively copy a folder to all of our NGINX Virtual Host htdocs folders: I need to copy that folder to all hosts located in ...
0
votes
0answers
54 views

Mirrored Linux Commands [on hold]

I've encountered two incidents where commands (or logic flow) is given forward and backwards In bash scripts: if ... fi (use to closed an if-statement) and in GNU/Linux command line: cat; tac (cat ...
4
votes
1answer
111 views

One liner for padding columns (similar to printf) of output from the previous pipe command?

I'd normally use printf to pad each cell with enough whitespace to maintain header position over its respective column. Ultimately I can just iterate over each line of the output and do enough cut ...
1
vote
4answers
5k views

Kill all process of users in Ubuntu?

How to kill all process of one user? When I make ps aux I obtain a list of process with several users, and I want to kill all process of user name1 for example! What's a command to do that in Ubuntu? ...
16
votes
2answers
402 views

How to retrieve lost aliases?

Let me start by saying I know this was dumb. Time and Linux make fools of us all. I made an echo command to my .bash_aliases file and erased all of my aliases, except the test alias. However, I ...
7
votes
2answers
5k views

Samba mount with password prompt as non-root user

I want to mount a password-protected SMB share (served by a Windows machine). The share is protected by a user name and password, and I may not write the password in a file, I want to be prompted for ...
1
vote
3answers
42 views

How to rename file using substring of the same file name [duplicate]

I want to rename my file with its substring.Because unfortunately renamed all the files in my server. Now I want to remove suffix( .gz) of all the files including files in subdirectories also. Below ...
17
votes
5answers
14k views

Is it possible to mount a gzip compressed dd image on the fly?

I like create an image backup for the first time I'm backing up a system. After this first time I use rsync to do incremental backups. My usual image backup is as follows: Mount and zero out the ...
2
votes
2answers
291 views

Proper syntax for “id -r” command

I'm trying to see if id -r will print out the UID or username of the user who logged into the system despite any su's or sudo's. I'm interested in doing this so I can keep people a little more ...
0
votes
3answers
36 views

How do you view a sql.gz file as plain text SQL from the command line?

How do you view a sql.gz file as plain text SQL from the command line? I want to read the SQL statements stored in a .sql.gz file, from the command line on the server. I've tried tar -xzvf, but get ...
-1
votes
4answers
93 views

Need a command sequence that will move files from one directory to another based on a particular year? [duplicate]

I'm looking for a sequence of commands (one liner would be ideal) which will identify all the files created in particular year, and move the resulting files to another directory.
-3
votes
0answers
22 views

How can I join domain on window 7 on suse [closed]

When I join domain on window 7 with suse I can not Join because It is displayed like
1
vote
1answer
456 views

How to make festival evaulate its own scheme expressions from the command line, so as to change voices as needed?

I can't seem to find any documentation on this. This forum post shows someone trying to change the voice used by festival, outside of the festival interpreter, using a command-line flag. festival ...
7
votes
3answers
166 views

Local, timestamped logging of all ssh commands?

How can I keep a local, timestamped record of all remote commands I use in ssh (command-line openssh client started through bash)? Requirements: Essential: 100% client-side without relying on ...
1
vote
2answers
3k views

checking running process

I am new babe to Linux. So please skip to read if you are not patient with begineer. Let's say I am asked to check and shut down the processes that I am not familiar with. So when I ls under bin ...
5
votes
5answers
2k views

How can I run `watch` as a background job?

When I run: watch 'cmd >> output.txt' & the job gets suspended by the system: 3569 Stopped (tty output) Is there a workaround?
-1
votes
1answer
35 views

How to have back the command prompt after calling an application [duplicate]

In terminal I just type firefox and then Firefox starts, but I can not return to command mode anymore. How can I come back to command mode? I have already tried :q or exit, but neither work.
1
vote
1answer
34 views

Formatting an external HDD with Bash script

At my workplace we have an external HDD connected to a NAS device (Synology). There is a backup tasks which runs weekly and fills the external HDD after a while. Unfortunately the Linux-based OS of ...
3
votes
2answers
87 views

Short, simple command to create a group if it doesn't already exist?

What is the cleanest way to modify this command in bash to only run if the group does not exist? groupadd somegroupname A one-liner would be best.
2
votes
1answer
34 views

Play .wav when text scrolls in terminal

After watching a TV show, I came up with a fun idea. Is there a way to take that cheesy high-pitched sound effect they play every time text scrolls down a command-line screen on TV and play it when ...
155
votes
22answers
78k views

Repeat a Unix command every x seconds forever

There's a builtin Unix command repeat whose first argument is the number of times to repeat a command, where the command (with any arguments) is specified by the remaining arguments to repeat. For ...
16
votes
10answers
2k views

Run two commands on one argument (without scripting)

How can I perform two commands on one input, without typing that input twice? For example, the stat command tells a lot about a file, but doesn't indicate its file type: stat fileName The file ...
6
votes
3answers
1k views

How can I print good looking code

Similar to using markdown on Stack Overflow to create monospace output, how can I do that for my programs. I tried lp filename.txt and was pleasantly please to find that it was able to use the local ...
6
votes
3answers
1k views

How to tweet using terminal?

I would like to tweet a message using terminal. I tried something like: curl -u 'TwitterUsername':'TwitterPassword' -d status=”Your Message Here” https://twitter.com/statuses/update.xml but seems ...
4
votes
2answers
19 views

Use non-root user configuration for root account

When I work with the terminal and use su or sudo to execute a command with the root user's permissions, is it possible to apply the configuration of my "non-root user" (from which I am invoking su or ...
0
votes
1answer
28 views

Must pass urls in quotes

I'm trying pass a URL to mpv for it to play it as a network stream. This can be done in bash with the following syntax: $ mpv http://myvideosite.com However, zsh wants to evaluate the URL as ...
6
votes
2answers
276 views

How to find out which program can open a given file?

Let's say I have a file thesis.pdf or picture.jpg Is there a command which returns a program to open this file with? I am aware of the command file, but it just returns the correct type of the file ...
2
votes
2answers
121 views

Remove all lines in file A which contain the strings in file B

I have a CSV file users.csv with a list of userNames, userIDs, and other data: username, userid, sidebar_side, sidebar_colour "John Lennon", 90123412, "left", "blue" "Paul McCartny", 30923833, ...
23
votes
4answers
2k views

Is it possible to define a command in bash?

For example, can I set gb = cd /media/Dan/evolution So that everytime I execute gb in bash, I can cd to that particular directory? I find something online, alias command. But It seems can't do the ...
3
votes
2answers
132 views

Creating a messagebox using commandline

How can I create a message box using command-line to show a text‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌‌?
2
votes
1answer
58 views

Why are aliases missing inside of bash command?

When I run in my terminal: alias a list with all my aliases (defined in ~/bashrc and ~/.bash_aliases files) will be displayed on my terminal. That's nice and as expected! But when I run: bash -c ...
15
votes
5answers
30k views

Is there a way to see details of all the threads that a process has in Linux?

For Windows, I think Process Explorer shows you all the threads under a process. Is there a similar command line utility for Linux that can show me details about all the threads a particular process ...
2
votes
0answers
42 views

How to make grub Command Line Default?

I'd like to make grub by default load it's command line instead of automatically booting from it's list of options generated by update-grub. How can I do this?
18
votes
9answers
6k views

Is there a robust command line tool for processing csv files?

I work with CSV files and sometimes need to quickly check the contents of a row or column from the command line. In many cases cut, head, tail, and friends will do the job; however, cut cannot easily ...
1
vote
2answers
59 views

wget to get all the files in a directory only returns index.html

I'm new to using bash, and I have been trying to wget all the files from a website to the server I have been working on. However all I'm getting back is an index.html file. I let it run for 15 minutes ...
1
vote
4answers
99 views

How can I output the difference between 2 files?

My file consists of the the following; roughly: username:username:username:username:username The above line continues to about 600 characters. I use the awk command in order to use it as an ...
3
votes
5answers
618 views

Terminal-based spreadsheets and wordprocessor?

Are there any (good) terminal based (ie. runs in a VT, not in GUI/X) spreadsheets or wordprocessors for Unix/Linux? Can anybody remember the name of such programs which were popular before (eg. ...
4
votes
3answers
76 views

Write text messages between Unix and Windows

Is it possible to send text messages between two users of the same LAN, but the first running Windows with cmd and the second running Linux/Unix? I am not looking for an instant messaging service. I ...
8
votes
6answers
8k views

How do I install a PHP CLI with a usable interactive prompt on Debian Wheezy?

When I install php5-cli on Debian Wheezy (currently testing), the interactive prompt is very unusable due to missing readline support (bug 341868). What's the easiest way to install a version linked ...
3
votes
1answer
47 views

Run command based on output of another command

OS: AIX 7100-04-1216 So basically I'm trying to write a for loop that sees which volumegroups I have on my system, which filesystems reside in those volume groups and what the size of each of those ...