1
vote
3answers
44 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 ...
3
votes
4answers
66 views

Generate random numbers in specific range

After googling a bit I couldn't find a simple way to generate with a shell command a random number included in a specific range, between a minimum and a maximum. I read about /dev/random, ...
5
votes
1answer
372 views

What exactly are commands? How to identify? [duplicate]

I want to know what exactly are Linux commands? & how to identify and locate them?
6
votes
4answers
124 views

Is there a tool for summarizing what all commands do?

So I understand that there are man pages for getting the documentation when the internet is unavailable, or when you need advanced uses, but what if I'm offline and I don't even know what tool I need ...
-3
votes
1answer
40 views

In what directory can I find the list of terminal commands or the set of scripts that give each one its purpose/power?

Is it hidden or accessible? Also, can you create a new script and define a new command to execute system-wide by adding it to this directory and giving it the same privileges?
0
votes
1answer
35 views

Is there any command to list all related files and folders to specified file in macosx?

I have many ctags in my macosx. When doing which ctags, it gave me /usr/bin/ctags. But I also want to know where is all related folders and files to this /usr/bin/ctags Any useful command?
20
votes
2answers
632 views

How do I move all files output from a command?

I have this grep command to find files without the word Attachments in them. grep -L -- Attachments * I want to move all the files that are output from that command. How do I do that in bash? Do I ...
2
votes
1answer
17 views

Retrieve system commands without reading sources

Sometimes I wonder how Linux programs achieve certain results knowing that they internally use system calls (system() or exec() in C programs). Given a working binary I wonder if it is possible to ...
0
votes
4answers
129 views

Can I have the shell ignore the command line sometimes but not always?

For debugging purpose sometimes I access a remote Linux box via VNC. At that time someone else may be working on that same Linux box through VNC and it may happen that I do not have facility to chat ...
4
votes
4answers
624 views

How to randomly sample a subset of a file

Is there any Linux command one can use to sample subset of a file? For instance, a file contains one million lines, and we want to randomly sample only one thousand lines from that file. For random ...
1
vote
1answer
38 views

Mysql import the most recent file from a directory

I have a directory with daily backups of my entire MySQL database. I want to import the most recent backup into the database. I know to import a backup I need to use mysql -u root -ppasswordhere ...
7
votes
2answers
131 views

what is `env <command>` doing?

What is the command env ls -al doing? I had a Linux test and there was question: "How to run command directly, but not its alias?" I knew that there exists solution like prefixing command with some ...
1
vote
2answers
96 views

Using globbing/wildcards when Opening Files from Terminal

I have a folder A. Inside the folder, there are some files a,b,c,d and there is a subfolder, B, containing files e,f,g. Suppose I want to open files a,b,c,d: then I just type xdg-open *. However, ...
0
votes
1answer
36 views

In which way is a commented line active in a program file?

To solve the bug reported here the solution seems to be commenting, not just adding a certain line in a file - as explained here and here. That is - to make that bug disappear in Xfce, a certain line ...
12
votes
5answers
4k views

Delete 100 lines from vi editor using single command

I am using Ubuntu and trying to delete all 100 lines from vi editor but I got interview question of doing this in one command.
0
votes
1answer
89 views

How can I see the rate of my wireless card?

I am setting manually the bit-rate of my wireless card ! sudo iwconfig wlan0 rate 54M Where can I see if it is applied, because the command does not give any feedback !!!
4
votes
4answers
539 views

What does <<< mean? [duplicate]

What does <<< mean? Here is an example: $ sed 's/a/b/g' <<< "aaa" bbb Is it something general that works with more Linux commands? It looks like it's feeding the sed program with ...
0
votes
2answers
256 views

'df' command doesn't list /home directory

In the book I am reading, the output of df command is shown like this: Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda2 15115452 5012392 9949716 34% / /dev/sda5 59631908 ...
2
votes
3answers
1k views

Why does Firefox refuse to die despite killing it with pkill -9?

I am issuing the following command to kill Firefox on my Red Hat Linux box: [subhrcho@slc04lyo ~]$ pkill -9 -f firefox [subhrcho@slc04lyo ~]$ However, when I try to invoke Firefox through ...
3
votes
2answers
295 views

Please explain the -f option in pgrep

man pgrep says the following about -f option: -f The pattern is normally only matched against the process name. When -f is set, the full command line is used. What does it ...
3
votes
2answers
197 views

Make copies of a single directory to multiple directories with different names

I'm trying to replicate a single directory (with sub-directories) to a bunch of new directories based on a list. For example I can: mkdir Fred Barney Thelma Louise Foo Bar How would I copy a premade ...
5
votes
1answer
762 views

Git auto-complete

I am using Git as many of you do. Also, I don't use any GUI for that — just CLI. So I was wondering: are there any way to make Git commands (git status, git checkout etc.) complete themselves when ...
0
votes
1answer
82 views

Why does this compound command report errors when copying directories? [duplicate]

Possible Duplicate: Why does this compound command report errors when copying directories? if one executes the following two commands in one line, as follows, rm -rf dir ; cp -r dir2 ...
-1
votes
1answer
1k views

Check if the command exists in bash

I want to check if a given command exists in bash and I care only about the native commands of the bash and not the scripts written by the user. When I refer to native commands I mean all those ...
3
votes
1answer
521 views

Searching a file & excluding lines with a specified string

I have a large log file that contains numerous lines of the same entry, lets call it "repeat-info". As an example here is what a portion of the log might look like: [Timestamp] repeat-info ...
1
vote
3answers
175 views

how to forbid a command without a permission

I intended to delete all the backup files in a directory, so I was going to type rm *~ in the terminal. Unfortunately, I hit the Enter before hitting the tilde and unhappy things happened. Although, ...
3
votes
2answers
2k views

How to execute one command on all files within a folder

Saying, I have this tree and I want to execute ruby on all scripts within the folder. How could I archive through one line of command. ./ ../ rb-script/ sample1.rb sample2.rb