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

learn more… | top users | synonyms (1)

2
votes
2answers
30 views

What are these memory strings? What do they do?

Recently, I dumped my memory strings (just because I could) using sudo cat /dev/mem | strings. Upon reviewing this dump, I noticed some very interesting things: .symtab .strtab .shstrtab .note.gnu....
0
votes
1answer
27 views

Possible to reuse first argument of BASH line in the same line?

I do this in BASH echo test "$1" ..expecting to get.. test test ..but I get.. test Is this something possible to do? It would make my life easier since having a list files I could do ...
3
votes
2answers
298 views

How to change the color of all highlights in a PDF file?

I want to change the color of every highlight in a PDF file (without having it do for every highlight manually). Preferably with a command line command. Here is an example PDF with a highlighted line....
0
votes
2answers
28 views

Generating strings of words with space delimiters from cut statement

I am new to bash. When I run the following command: grep "type" /root/myFile | cut-d'=' -f2 I get the following: 102 304 503 442 I want to store the contents of the first command into a ...
2
votes
3answers
29 views

Ignore specified absolute directories with tab completion?

I work on a cluster with many users. There are 50 users on the cluster with the same first letter as my username, and a user who has the same name up to the last letter. When I tab complete from /home/...
3
votes
1answer
30 views

Can I get just the list of network interfaces from ip?

I am looking to retrieve a list of network interfaces. Currently I am returning the results of ip addr and then doing some regex/string searching from output like this: 1: lo: <LOOPBACK,UP,...
0
votes
5answers
46 views

Return one value and save it into a variable

I have this sentence that returns two values. cat /ora$sid/dbs/listener.ora|grep PORT|sed 's/.*PORT.*\([0-9]\{4\}\)\(.*\)/\1/' Return 1521 1522 With this sentence I want to get only one value. ...
4
votes
1answer
199 views

How to know the utilization of intel CPU and GPU in Linux?

In ubuntu, to know the time taken by CPU to run a program we would use time in terminal. Whereas in case of intel GPU, we would use intel_gpu_time. But in case of CentOS time command works. But ...
17
votes
6answers
52k 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
2answers
30 views

BASH get value from string

I have this string stored in a variable <li class="rainbow-list-item southern disrupted " data-line-id="lul-southern" data-severity-codes="4,6,9" data-mode="national-rail"> and I would like ...
1
vote
1answer
18 views

Ask for password while mounting cifs share

I am looking for a way to make the mount command prompt for the password so my password doesn't show up in any system history, I thought I would have it run read -s -p command inside of the mount ...
-4
votes
1answer
35 views

How to fix whois Command Error

i have Kali Linux version 2016.1 installed on my system. i am trying to run command "whois " but there is an error "bash: whois: command not found"
0
votes
0answers
30 views

Delete files based on files name comparing to sysdate? [duplicate]

I've files with a prefix name like this: 20160623a.dat 20160623b.dat 20160623c.dat 20160623d.dat [20160623] is a prefix that generated with date "+%Y%m%d" command. I'd compare this prefix to ...
2
votes
3answers
136 views

How to search a text file for a specific integer

Is there a simple way to search a text file (source code) for all instances of a specific integer. This should not trigger on larger numbers that happen to include the integer as a sub-string, but it ...
56
votes
6answers
184k views

How to stop a background process?

I have started a wget on remote machine in background using &. Suddenly it stops downloading. I want to stop its process, then start it again. How can I stop it? I haven't close its shell window. ...
3
votes
2answers
36 views

Is there a shortcut to rerun a command with arguments from last command (not cd, ls or echo)

Searching through passed Logfile with something like this: cat /path/to/logfile | grep -iEw 'some-ip-address-here|correspondig-mac-adress-here' This gives me all the passed log lines until now so ...
0
votes
1answer
42 views

Rename file (Prefix) with full path?

I'd to Prefix my files (.dat) like this : CLY_BIZ_COM_PERD.dat -> 20160622CLY_BIZ_COM_PERD.dat I have tried the following: key=`date "+%Y%m%d"` for i in $(ls /Path/*.dat); do mv ${i} "${key}${i}...
1
vote
2answers
129 views

How to remove the same size files in a directory?

I have images, I need to delete some files with the same size. But no need to remove all such images, but only the next in the queue (in alphabetical order): 1.png # 23,5 Kb 2.png # 24,6 Kb 4....
6
votes
2answers
366 views

Remove all files with a prefix except the one of the largest size

What is the best way to remove all the files in the current directory with some prefix, except the file with this prefix but having the largest size among all the files with this prefix? (In the ...
0
votes
3answers
77 views

How to do a loop to execute many files

I have a script which function like this for one file. ./script 0001g.log > output for two or more files, like this ./script 0001g.log 0002g.log 0003g.log > output The script take one ...
1
vote
2answers
55 views

Count the number of lines found by grep

I want to know how many instances of a pattern are found by grep while looking recursively through a directory structure. It seems I should be able to pipe the output of grep through something which ...
2
votes
1answer
29 views

SQLite3 command line: how do you cancel a command?

I made a mistake writing a command at the SQLite command prompt, which I now want to abort, this is how my command line looks sqlite> select * from todos' ...> ' ...> ;^C In this ...
41
votes
6answers
23k views

Split pages in pdf

I have a scanned pdf file which has scanned two pages on one virtual page (page in pdf file). The resolution is with good quality. The problem is I have to zoom when reading and drag from left to the ...
8
votes
2answers
44k views

How to fix curl sslv3 alert handshake failure?

I'm trying to curl HTTPS website in the following way: $ curl -v https://thepiratebay.se/ However it fails with the error: * About to connect() to thepiratebay.se port 443 (#0) * Trying 173.245....
0
votes
3answers
104 views

htop displays incorrectly on different vps

When I use "htop" command for linux (+F5), layout on 2 my vps different: Why on my first server I see broken tree?
31
votes
7answers
5k views

How do I create a blank PDF from the command line?

I recently needed a single blank PDF page (8.5" x 11" size) and realized that I didn't know how to make one from the command line. Issuing touch blank.pdf produces an empty PDF file. Is there a ...
0
votes
0answers
45 views

How can get the screen command to work properly? [on hold]

I'm trying to work out how to use the Unix screen command. I'm using Zsh on Mac OS 10.11.3. So far, nothing is working as described. If I type screen as directed, this is the result... I don't ...
66
votes
12answers
84k views

Efficiently delete large directory containing thousands of files

We have an issue with a folder becoming unwieldy with hundreds of thousands of tiny files. There are so many files that performing rm -rf returns an error and instead what we need to do is something ...
2
votes
0answers
190 views

How do I recursively apply default ACLs of a directory to its descendants?

If I have a directory with default ACL entries assigned to it, but some or all of its descendant files and sub-directories have access or default ACLs that do not agree with those defaults, how do I ...
0
votes
0answers
43 views

First 0 of a number is being trimmed [on hold]

I use this line to get the (unique) value from a file and use it as an argument in a bash script like so: casperjs script.js --num=`cat num` The script works well. Except that when the number ...
0
votes
2answers
32 views

Uuencode is displaying the file contents in email body instead of attaching the file in the attachments

I want to send a simple text file as an attachment in an email. When the email is delivered, the attachment is missing, instead, the contents of the attachments are displayed in the email body. Need ...
4
votes
2answers
70 views

Why does path-completion in bash not always work?

With different bash-environments (different installations) I have different behaviors in terms of path-completion when hitting TAB on the command line after . Where is this handled? One specific ...
5
votes
1answer
44 views

Display stdout and stderr in two separate streams

I'm looking for a way to visually separate stdout and stderr, so that they don't interleave and so that they can be easily identified. Ideally, stdout and stderr would have separate areas on the ...
3
votes
2answers
31 views

Forward results of Find command to javac

I wish to compile the results of a find command where the find command returns the relative filepath of a java file located in subdirectories. E.G., I am in ./ and I want to run javac on a file, ...
2
votes
3answers
465 views

Pass output of “whereis” command to “cd” to change directory in one step

It should be simple no-doubt, but I can't find a way to pass output of whereis command to cd command in same line so I don't have to do cd in the second step. I have tried passing like below: cd $(...
7
votes
1answer
837 views

shebang line not working with cr-lf

Why are the shebang parts of the following elementary scripts not working: $ cat hello.sh #! /bin/sh echo Hello $ ./hello.sh bash: ./hello.sh: /bin/sh^M: bad interpreter: No such file or directory $ ...
0
votes
4answers
55 views

Delete specific line numbers (passed as variable) from a file in linux

I have two files. One having list of lines (which I don't require) say Seqlist and other text file (from which I intend to delete those corresponding lines) say ContentFile $cat Seqlist 3 4 ...
2
votes
1answer
50 views

Submit password with sudo and execute script with nohup

I would like to download and run a script in the background so the task is independent of the shell and its exit. Moreover this script should be run as sudo, using: echo MY_PWD | sudo -u MY_USER -S .....
-3
votes
0answers
37 views

I want something to be printed at the start and end of dmesgs [on hold]

echo " END COLLECTING DMESG_">/dev/kmsg is the command I used before running an IO and after running an IO. Once after clearing dmesg, sometimes I was unable to print the statement.
1
vote
1answer
23 views

Use SELinux to restrict a directory to a particular user

I have a couple of questions: (Sysadmins tasks) Here is what I asked to do Create user Tim and add him to the supplementary group Webdev (Create the group if it doesn't exist), also Set Tim's ...
3
votes
1answer
2k views

How to access u boot environment from linux?

How can I access and change the u-Boot env variables in linux. Using the u-boot/tools/env directory in u boot directory: u-boot$ make env Which created the executable file fw_printenv. I copied ...
1
vote
0answers
22 views

open several directories from the terminal as tabs inside a single file manager window

I want to open several directories from the terminal as tabs inside a single Nautilus window. If Nautilus cannot be used then I want to know what GUI based file explorer can open directories in ...
55
votes
13answers
129k views

How can I get a count of files in a directory using the command line?

I have a directory with a large number of files. I don't see a ls switch to provide the count. Is there some command line magic to get a count of files?
11
votes
5answers
9k 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 ...
67
votes
10answers
46k views

How can I move files and view the progress (e.g. with a progress bar)?

When moving large directories using mv, is there a way to view the progress (%)? The cp command on gentoo had a -g switch that showed the progress.
0
votes
1answer
35 views

Curl to grab the page after complete load

I have a url which takes some time to load completely. But when I use curl to download the link as html, it download the html at the real time before loading page completely I mean complete execution ...
0
votes
1answer
46 views

Unix, create file based on command [duplicate]

I have a command, but I want to get the results into a .txt file I can open. How do I alter my command to allow the results to be put into a text file. I plan to transfer this .txt file to my local ...
1
vote
2answers
57 views

How to zip directory with encryption for file names?

Using command line, I know that I can encrypt a directory with the following command: zip -er Directory.zip /path/to/directory However, this does not encrypt the filenames themselves. If someone ...
1
vote
2answers
44 views

How to move string from one line to another

I have been editing a large text file containing pairs of lines as follows (repeated): \> destination_file.txt js -e "var e='.jpg',t='b',i='14712583',h='0.us.is.example.com',s='/',n='WIV',u='...
-1
votes
0answers
35 views

dd does not work for an image created in freebsd 9.3

I tried to dd the image created in freebsd 9.3 $ sudo dd if=test.img of=/dev/disk2 bs=1m Password: 0+0 records in 0+0 records out 0 bytes transferred in 0.000010 secs (0 bytes/sec) This works in ...