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

learn more… | top users | synonyms (1)

1
vote
3answers
38 views

Deleting all files except folders within directory

I am still pretty new to terminal based commands but while I was doing a rsync command between remote and local, I have accidentally 'copied' the files to the wrong place (Eg. /serA/items) instead of ...
44
votes
13answers
26k views

Markdown Viewer

I found a file formatted with Markdown. Could you guys suggest what viewer that I could use to view this type of files? Hopefully one without gui (if it's possible) Update I was actually looking for ...
1
vote
2answers
211 views

Play a sound file slower or faster

How can you play a sound slower or faster? That would be useful for listening carefully one audio passage or to listen fast forward to find a concrete passage. Is there something with the play sox ...
24
votes
12answers
12k 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
21 views

Can I pipe clipboard content to browser for viewing?

Here is the situation. I often have to read chunks of information from large plain text files. I am planning to use Readability extension for formating the content to make it readable on screen.
1
vote
3answers
70 views

Is there a way to undo a terminal command?

I just copied a whole directory into another one using cp ~/local/* ./ and actually wanted to type cp ~/local/srl* ./ so I'm founding myself with a lot of unnecessary files. I can suppress them ...
2
votes
2answers
54 views

How can I compare two files and create another file that aren't in first file?

file1 contains: 100 200 300 400 file2 contains: 500 600 700 200 300 Expected output file will be: 500 600 700
2
votes
1answer
27 views

Merge text files with 1st column and difference in output file

File 1: (text1.txt) Row_Added_Ts Count 01/01/14 2022448 02/01/14 8345155 03/01/14 8663852 04/01/14 6785739 05/01/14 5279913 File 2: ...
1
vote
1answer
22 views

OSX: Delete all matching certificates by command-line

Using shell script to delete all matching certificates. I found a list of certificates using: security find-certificate -c "certificatename" -a -Z|grep SHA-1|awk '{ print $NF }' Output is like ...
0
votes
2answers
28 views

Wrong zip command messed up my project directory

I've issued a command gzip -r project.zip project/* in projects home directory and I've messed things up; every file in project directory and all other subdirectories have .gz extension. How do I undo ...
19
votes
8answers
5k views

How to efficiently generate large, uniformly distributed, random integers in bash?

I have been wondering what would be the best way to get good randomness in bash, i.e., what would be a procedure to get a random positive integer between MIN and MAX such that The range can be ...
44
votes
11answers
18k views

Easy way to determine virtualization technology

I have command line access to a Linux machine which may or may not be virtualized. I want to determine what kind of virtualization technology it runs on, if any (VMWare, VirtualBox, KVM, OpenVZ, Xen, ...
26
votes
8answers
105k views

How to determine Linux kernel architecture?

uname -m gives i686 and uname -m gives i686 i386 output in Red Hat Enterprise Linux Server release 5.4 (Tikanga) machine. I need to install Oracle Database 10g Release 2 on that machine. So, how can I ...
1
vote
1answer
3k views

Proper escaping of double quotations for curl post data?

I'm trying to test out a server, by sending it JSON data and reading the response. I need to POST data like {"item":"value with spaces"} but when I use curl I find that it sends the backslashes as ...
202
votes
23answers
133k views

Repeat a Unix command every x seconds forever

There's a built-in 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 ...
0
votes
1answer
26 views

extract subfolders outside and rename if necessary

I have a directory looks like: dhcp-18-189-47-44:CE-06-new-stuctures_backup wenxuanhuang$ ls DFT-00001 DFT-00004 DFT-00007 DFT-00010 DFT-00013 DFT-00016 DFT-00019 DFT-00022 DFT-00025 DFT-00028 ...
1
vote
3answers
54 views

Command line to go in directory passed by which command

I want use a command such as this : which node && cd $_ to jump in the directory when the binary file reside, but the which command return all the path + name of binary ,so i get an error ...
2
votes
2answers
46 views

adding column in CSV file using awk

I need to a add a column in CSV file from an array using awk. For example, input.csv a,10 b,11 array = (100 200) output.csv should look like a,10,100 b,11,200 I tried this command but it does ...
9
votes
4answers
8k views

Count number of lines of output from previous program

I'm trying to count the number of lines of output a certain program produces. The problem is, the program takes a long time to run, and I want to display the output to the user. Is there a way to ...
15
votes
5answers
6k views

How to shut down the computer after a task has been completed?

I usually start a download before I go to school. Which command should I use to automatically make the necessary saves and turn off the computer after a particular task has been completed? (Say, ...
0
votes
1answer
21 views

How to find what the “Mate version” of programs are called

On Mate systems, many programs correspond to (and are sometimes forks of) other programs with more well-known names: nautilus -> caja gnome-terminal -> mate-terminal ark -> engrampa gedit -> pluma ...
6
votes
1answer
1k views

What do I need to add a virtual IPsec adapter?

I'm trying to set up an IPsec connection manually from the console with iproute2. What I need is a virtual interface (at best, a virtual IP address could also be sufficient) that IPsec-transforms ...
0
votes
2answers
1k views

Bring up shutdown menu of Cinnamon via command line

How can I bring up the shutdown menu of Cinnamon via command line? Note: I don't want the user menu. This menu for switching or logging out a user is brought up via Ctrl+Alt+Del.
1
vote
2answers
53 views

How to use ln -s to create a command line shortcut?

I have an sh file that I would like to be able to open from the terminal at any time. I would like to type "studio" into the terminal, and have android studio open I recall using ln -s to do this, ...
1
vote
0answers
16 views

List `yum/dnf` history in ascending (reversed) order

When you run yum history (or dnf history) it will give you the list of action starting from the last, most recent action being on top of the list. In case you have a lot of history steps your recent ...
14
votes
2answers
505 views

What does CTRL+4 (and CTRL+\) do in bash?

I just found out by accident that CTRL + 4 closes programs reading stdin input from the command-line. This is how it looks when I type CTRL + 4 or CTRL + / into programs reading stdin ryvnf:~$ ...
6
votes
1answer
834 views

How to write/edit/update the OsIndications efi variable from command line?

In the need to enter the UEFI firmware setup utility while using ultra fast boot (keyboard drivers are not loaded during POST), I wish to write to the "Os Indications" efi variable. My OS is Ubuntu ...
1
vote
2answers
166 views

What command should I use to move these particular elements?

Here is my initial situation: In a folder named for example Father, are stored some files in the following way: Father contains 24 children folders (let's call them Child1, Child2, ...), and each one ...
3
votes
1answer
212 views

prevent a command from sending both stdout & stderr to any terminal or file [duplicate]

I would like to prevent my program from sending stdout and stderr to any terminals, files or devices. For this, I have three command crossing my mind, but I cannot distinguish their differences. Could ...
23
votes
9answers
102k views

How to connect to a serial port as simple as using SSH?

Is there a way to connect to a serial terminal just as you would do with SSH? There must be a simpler way than tools such as Minicom, like this $ serial /dev/ttyS0 I know I can cat the output ...
1
vote
5answers
10k 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 ...
2
votes
2answers
55 views

How can I turn `file` tool into a predicate for `find`?

I have something like: find . -type f -print0 | xargs -0 file | grep Matroska | cut -d: -f 1-1 | xargs rm I want something like: find . -type -f -filemagic "Matroska" -delete
1
vote
2answers
36 views

linux terminal transfer control to new terminal [closed]

in one of my shell program, I want start an xterm window from terminal and then the control of next execution should go to the newly opened window (by default the control will be in the terminal). ...
0
votes
1answer
25 views

How to run bunch of hierarchical dummy shell processes (process of another process, etc.)?

I would like to run multiple processes where each process is running another one, so it will create a long process branch. I've tried: $ bash -c '(bash -c "sleep 20"); sleep 20' & $ pstree ...
22
votes
10answers
3k 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 ...
47
votes
8answers
99k views

How do I make my pc speaker beep

Using bash, how can I make the pc speaker beep? Something like echo 'beepsound' > /dev/pcspkr would be nice.
5
votes
3answers
124 views

Retreat from deleted directory

Suppose I am editing some files. I have (say) a terminal open and a gui file manager. I am currently in /my/very/long/and/winding/directory/path in the terminal. In my gui, I delete ...
5
votes
4answers
2k views

Delete everything except a few extensions

Can I modify the rm command with regular expression or something to delete. every file in current directory except files with extensions *.bmp, *.wav and *.png? It should be case insensitive because ...
31
votes
2answers
27k views

How to remove a single line from history?

I'm working in Mac OSX, so I guess I'm using bash...? Sometimes I enter something that I don't want to be remembered in the history. How do I remove it?
4
votes
2answers
203 views

grep string where next line does not contain string

I want to search all files inside a directory and its subdirectories for lines containing a certain string, but I want to exclude those results that contain a different certain string in the line ...
3
votes
3answers
48 views

Find a pattern and insert # at the beginning of 2 line befoe that and 1 line after that

I have a big file (more than 2000 lines). Where i have to insert a # at the beginning of 2 above lines and at the beginning of 1 below line after finding a pattern. Also insert # at the beginning of ...
0
votes
1answer
60 views

SED - Find and replace with special characters (#, , % )

I'm aware that this is a really simple question, but I'm struggling to find a solution to this . I need to automatically find and replace in the /etc/aliases file the following section: # Person ...
-1
votes
1answer
116 views

How to use the “source” command to run commands simultaneously?

For example, I have an executable called ex01 (C++ program). And I have a text file that contains a set of invocations of this program with different arguments. The text file looks like this: ...
1
vote
1answer
44 views

Is it Possible to globally set the java hs_err log Location?

I know when executing a jar using the command line option -XX:ErrorFile=[location] allows you to change where the hs_err log files are placed. I am wondering: is there is a place I can globally ...
29
votes
3answers
137k views

Zip all files in directory?

Is there a way to zip all files in a given directory with the zip command? I've heard of using *.*, but I want it to work for extensionless files, too.
28
votes
6answers
12k views

How do I split a flac with a cue?

I've got a full album flac, and a cue file for it. How can I split this into a flac per track. I'm a KDE user, so I would prefer a KDE/QT way, I would like to see command line and other gui answer's ...
0
votes
1answer
56 views

How to grep the following lines from a file?

I have a file which has the names of many files in a directory in the following format: A20150824.0950-0955_jambala_CcnActiveSessionCounterJob A20150824.0945-0950_jambala_CcnActiveSessionCounterJob ...
3
votes
4answers
2k views

Home key not working in terminal

I am using GNOME Terminal 2.7.3 and zsh 4.3.9 (x86_64-unknown-linux-gnu) Home and End are not working. Nothing happens and nothing gets displayed when I press them. but they work when I press shift + ...
2
votes
1answer
32 views

Openssl passing a binary pass phrase as a argument

This openssl command is working fine for me. openssl aes-128-ecb -d -in encrypted_base64.txt -K 4D1D75237C31E7732030C69F209F23154418373335E049C4F567C7B6D422ABD0 -base64 How would I do the ...
10
votes
7answers
15k views

Doing simple math on the command line using bash functions: $1 divided by $2 (using bc perhaps)

Sometimes I need to divide one number by another. It would be great if I could just define a bash function for this. So far, I am forced to use expressions like echo 'scale=25;65320/670' | bc but ...