Tag: command-line

63 votes
7 answers
2.7K views
Run R script from command line

I have a file, called a.r, it has a chmod of 755, sayHello <- function(){ print('hello') } s

avatar
Keith
0 1 0 9
asked 07 September, 2021
56 votes
18 answers
1.3K views
How do I edit a file after I shell to a Docker container?

I successfully shelled to a Docker container using: docker exec -i -t 69f1711a205e bash Now I need to edit

avatar
Corey
0 1 0 9
asked 07 September, 2021
54 votes
15 answers
1.7K views
How can I get a list of user accounts using the command line in MySQL?

I'm using the MySQL command-line utility and can navigate through a database. Now I need to see a list of

avatar
Patsy
0 1 0 9
asked 07 September, 2021
60 votes
29 answers
1.5K views
Argument list too long error for rm, cp, mv commands

I have several hundred PDFs under a directory in UNIX. The names of the PDFs are really long (approx. 60 chars

avatar
Frederick
0 1 0 9
asked 07 September, 2021
55 votes
16 answers
1.7K views
How to force cp to overwrite without confirmation

I'm trying to use the cp command and force an overwrite. I have tried cp -rf /foo/* /bar, but I am still

avatar
Dwain
0 1 0 9
asked 07 September, 2021
56 votes
27 answers
501 views
How to count lines in a document?

I have lines like these, and I want to know how many lines I actually have... 09:16:39 AM all 2.00 0.0

avatar
Luis
0 1 0 9
asked 07 September, 2021
58 votes
30 answers
732 views
How to change the output color of echo in Linux

I am trying to print a text in the terminal using echo command. I want to print the text in a red color. How

avatar
Dusty
0 1 0 9
asked 07 September, 2021
57 votes
10 answers
1.5K views
Matlab: Running an m-file from command-line

Suppose that; I have an m-file at location:C:\M1\M2\M3\mfile.m And exe file of the matlab is at this locatio

avatar
Lashawna
0 1 0 9
asked 07 September, 2021
62 votes
22 answers
748 views
Use grep --exclude/--include syntax to not grep through certain files

I'm looking for the string foo= in text files in a directory tree. It's on a common Linux machine, I

avatar
Venice
0 1 0 9
asked 07 September, 2021
61 votes
14 answers
781 views
How to reload .bash_profile from the command line?

How can I reload .bash_profile from the command line? I can get the shell to recognize changes to .bas

avatar
Bryan
0 1 0 9
asked 07 September, 2021
59 votes
14 answers
1.1K views
How do I set a variable to the output of a command in Bash?

I have a pretty simple script that is something like the following: #!/bin/bash VAR1="$1" MOREF='sudo r

avatar
Elicia
0 1 0 9
asked 07 September, 2021
52 votes
12 answers
1.3K views
How do I copy a folder from remote to local using scp?

How do I copy a folder from remote to local host using scp? I use ssh to log in my server. Then, I would like

avatar
Scot
0 1 0 9
asked 07 September, 2021
57 votes
9 answers
3K views
POST XML file using cURL command line

How can I POST an XML file to a local server http://localhost:8080 using cURL from the command line? What comm

avatar
Carmelina
0 1 0 9
asked 07 September, 2021
67 votes
11 answers
2.1K views
How to pretty print XML from the command line?

Related: How can I pretty-print JSON in (unix) shell script? Is there a (unix) shell script to format XML in

avatar
Emilia
0 1 0 9
asked 07 September, 2021
65 votes
30 answers
1K views
How do I pass command line arguments to a Node.js program?

I have a web server written in Node.js and I would like to launch with a specific folder. I'm not sure ho

avatar
Wilfredo
0 1 0 9
asked 07 September, 2021
52 votes
8 answers
543 views
Pretty print in MongoDB shell as default

Is there a way to tell Mongo to pretty print output? Currently, everything is output to a single line and it&a

avatar
Percy
0 1 0 9
asked 07 September, 2021
50 votes
30 answers
1.3K views
How do I import an SQL file using the command line in MySQL?

I have a .sql file with an export from phpMyAdmin. I want to import it into a different server using the comma

avatar
Sydney
0 1 0 9
asked 07 September, 2021