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

learn more… | top users | synonyms (1)

1
vote
2answers
199 views

Change terminal text color for next command only

So when I find myself compiling a lot (from the terminal) I find it difficult to distinguish between the current compilation results and the old ones, so I was wondering if there is a bit of text that ...
85
votes
3answers
325k 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.
1
vote
1answer
32 views

How to Find, remove and show counter via SSH?

I want to run a command which searches for specific files, then removes them then show how many already is deleted. So far I was using: find -type f -name "*.cache" -exec rm {} \; but when I have ...
-1
votes
4answers
75 views

how to move back from a current directory

Hi if suppose I am curently here: cd Desktop/kinectrobot/src/beginner_tutorials/src and after that working in src i want to move back one directory for example I want to go to beginner_tutorials. ...
0
votes
2answers
103 views

rename multiple directories by adding one character [duplicate]

I have multiple folders named as follow: Name1 Name2 ... Name9 Name10 Name11 ... I need to rename them using mv command into: Name01 Name02 ... Name09 Name10 Name11 .....
1
vote
1answer
75 views

umask vs -m, --mode command options

Is there any technical merit/necessity to numerous *nix commands (mkdir, mkfifo, mknod) having a -m (--mode) option? I ask this because near as I can tell, umask (both the shell command and the ...
1
vote
3answers
86 views

How to search multiple search patterns from a file with grep

If I search for multiple search strings in grep : usually just do: grep "search1\|search2" somefolder/*.txt but, what if I have 100 or more search strings? Can I say like this: grep "stringPattern....
0
votes
2answers
162 views

Use multiple commands in sed to insert text after string with special characters

I am having a little trouble trying to do a search and replace using sed in a config file. I want to use multiple commands using the -e option to do the following. Step 1: find the first occurrence ...
0
votes
2answers
1k views

Can the UNIX command tree display only directories matching a pattern?

I'm trying to figure out if there is a way to get the UNIX command tree to display only directories that match a specific pattern. % tree -d tstdir -P '*qm*' -L 1 tstdir |-- d1 |-- d2 |-- qm1 |-- ...
3
votes
6answers
96 views

checking the largest number of a specific folder

Inside one of my folder I have a lot of files looks like enum-* $ ls PRIM enum-00020 enum-00040 enum-00059 enum-00078 enum-00101 enum-00122 enum-00141 enum-00160 enum-00179 ...
1
vote
2answers
116 views

Print the first and last match of a field with awk

I have a tab delimited file: qrs John tuv abcd Sam efgh ijk Sam lmnp abcd Sam efgh ijk Sam lmnp qrs John tuv I am trying to print the line in which the ...
41
votes
5answers
34k 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 ...
8
votes
4answers
4k views

Recursively add a file to all sub-directories

How do I recursively add(or touch) a file into the current directory, as well as all sub-directories? For example, I would like to turn this directory tree: . ├── 1 │   ├── A │   └── B ├── 2 │   └── ...
0
votes
2answers
2k views

USB Disk Read-only, cannot format - Turn off write-protection

I have a USB disk which does not allow me to format/mount/unmount or created partitions on it. Using dmesg | tail gives me the following result: I found this post on AskUbuntu and tried using ...
0
votes
1answer
25 views

Production ready derivative from LFS

I've recently started delving into LFS and have been wondering if there are any popular or well-used distros that have been derived from LFS or BLFS. There are a few of completed projects on Github ...
0
votes
3answers
71 views

print last line of !! command

so I want to be able to print helloworld using the !! command. I tried creating a text file with the text helloworld on it. Then I say cat textFileName It prints helloworld. Then I say !! and it ...
0
votes
2answers
70 views

What is the command in linux, or a utility to know the current comand status (process status)

For example when I write telnet abc.wtf the telnet session begins saying trying to connect so and so IP, but is there a command that I can type in and know what is the current process happening to ...
0
votes
1answer
59 views

I want to delete from particular words in all the line if that particular word is present

eg: CREATE VIEW AIPKEYITEM.SEASONGROUPNETSALES ( CALENDARID , PRODUCTGROUPID FOR COLUMN PRDGRPID , NETSALESDOLLARS FOR COLUMN NETSA00001 , NETSALESUNITS FOR COLUMN NETSA00002 ) AS SELECT ...
5
votes
2answers
7k views

How to set custom resolution using xrandr when the resolution is not available in 'Display Settings'

I'm a new Linux user trying to change the screen resolution as there is no option under display. I have successfully managed to add new resolutions by fluke by following online guide. I don't have a ...
7
votes
2answers
4k views

Ignore “other” domains when downloading with wget?

I would like to crawl links under www.website.com/XYZ and only download the links that is under www.website.com/ABC. I am using the following wget command to get the files I want: wget -I ABC -r -e ...
0
votes
2answers
459 views

Linux command to display the contents of a given file byte by byte with the character and its numerical representation displayed for each byte [closed]

I am looking for the Linux command and option combination to display the contents of a given file byte by byte with the character and its numerical representation. I was under the impression that in ...
4
votes
4answers
626 views

Prevent tail from modifying the charset of the terminal

In a Linux terminal (CentOS) I am using the command tail --follow=name my-rolling-file.log in order to see the logs of my application. Sometimes in the log there is some binary data dumped (I dump ...
28
votes
6answers
43k views

Sorting files according to size recursively

how to scan a folder recursively and find the largest files in the folder, and sort them by size. I have tried using ls -R -S but it tends to list the directories as well I need to scan the folders ...
0
votes
2answers
3k views

grep: input file 'X' is also the output

I use ubuntu 14.4, and attempt to redirect the output of grep command to a file, but I keep getting this error: grep: input file 'X' is also the output I've searched for this issue and just found ...
1
vote
3answers
156 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 /...
1
vote
2answers
468 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 ...
1
vote
2answers
57 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
931 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
1answer
165 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: (text2....
1
vote
1answer
204 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
49 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 ...
22
votes
8answers
10k 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 ...
57
votes
11answers
39k 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, )...
0
votes
1answer
34 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 DFT-...
1
vote
3answers
77 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
678 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 ...
22
votes
4answers
17k 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 ...
16
votes
5answers
8k 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
237 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 ...
1
vote
2answers
469 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
60 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 ...
16
votes
2answers
1k 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:~$ ...
1
vote
2answers
186 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
548 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 ...
2
votes
2answers
62 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
124 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
62 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 $(...
24
votes
10answers
4k 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 ...
67
votes
8answers
140k 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
143 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 /my/very/long/and/...