Questions tagged [cat]

`cat` is a command-line utility used to concatenate or copy the contents to standard output from a file or standard input (if no file name is passed).

Filter by
Sorted by
Tagged with
0
votes
1answer
18 views

SETUID not working in my laptop [duplicate]

Suppose i have two files total 8 -r-sr-xr-x 1 root root 34 Oct 8 17:36 openroot.sh -rwx------ 1 root root 38 Oct 8 17:34 root.txt Content in root.txt : Hi I am root file. Content in openroot.sh : #...
0
votes
1answer
28 views

How to cat and print formatted more than one file?

I have a device in /sys/bus/iio/devices/iio:device0/, and device has lots of files such as in_current0_raw, in_current0_mean_raw, in_current0_scale ... I want to print them periodically in terminal. ...
0
votes
2answers
163 views

How do I search in multiple files with “cat”? [duplicate]

What I want is to find within a directory all the files containing a match and when it finds the match it shows the file where that match was found. example cat * | grep password: Here it will show ...
0
votes
2answers
86 views

Receiving Permission denied when trying to use cat command to create a file [duplicate]

I am working with Ubuntu version 18.04.4 LTS. I tried to create a file using the following command: sudo cat > filename.yaml and received a "Permission denied error" I can create the file using the ...
0
votes
0answers
20 views

Unable to run “cat /var/lib/dbus/machine-id” from .NET Core on linux

I am working on a .NET Core application. I have to find the machine id of the system from C# code. To get the machine id of linux machine, i am using the following C# code: Process proc = new System....
0
votes
1answer
45 views

How to copy the content of a file using command line

My question is may be too simple or hard Is there any way I can copy the content of a file using the command line the same as you do with right click + copy? After that I want to paste what I copied ...
0
votes
0answers
19 views

How to save text file after use cat -n command [duplicate]

I am created file use "cat > sample.txt". after i used "cat -b sample.txt". how to save it. ctrl+x or F2 is not working.cat -b command
-1
votes
1answer
84 views

Cat redirection not working

I used a command set -r noclobber Now I'm not able to reset. cat >1.txt shows Restricted: can't redirect output
0
votes
1answer
123 views

Two different terminal line commands - the same result

What is the difference between less file-name and cat file-name | less For example: less .bashrc and cat .bashrc | less output the same result.
0
votes
1answer
38 views

Search number list in multiple files and print

I am trying to find a few numbers listed in a file and their next +16 rows, from a bunch of files in a folder. Print or store output in a file, but the command is not displaying any output for i in ...
0
votes
1answer
30 views

How to output a file from line x to another

How can I output the projects.txt contents to another file named newProjects.txt starting from line 4 for example.
26
votes
5answers
7k views

What is the difference between “cat < filename” and “cat filename”?

The simplest way to display file contents is using the cat command: cat file.txt I can get the same result using input redirection: cat < file.txt Then, what is the difference between them?
0
votes
0answers
36 views

Using a cat * > function for files in a specific category

I'm trying to cat all .json files in the D:\Dumps\Dumps2019-10-17 directory and for the life of me I can't figure it out. Please help. Edit: I'm using the obunto terminal on a windows 10 os.
2
votes
3answers
339 views

Bash, command to variable (cat), output is on 1 line, <pre> is not working

Issue In bash, output is on 1 line from command, so <pre> is not working in html tag. log=`cat ../local/log/$(ls -t ../local/log | head -1 )` echo ' <tr style="background-color: rgb(250,...
2
votes
1answer
139 views

Program for Ubuntu to detect cat-like typing?

A feline hacker has invaded my home. She frequently crawls across and sits on the keyboard, causing all sorts of mayhem. I have gotten into the habit of locking my computer when I step away for a ...
1
vote
3answers
1k views

Cat command with variable in file name not working

I want to cat or read the contents of file giving absolute path that contains a variable but its not working.. None of the below commands are working. ($line here is the name of file) content=`(cat /...
0
votes
1answer
25 views

Average of CPU and memory use of ALL process that appear during some time interval

I know some ways that I can see the average of CPU and memory use for one process, but I never saw a way to see the average of all process that appeared during some time. The goal is, for example, to ...
0
votes
1answer
96 views

How to change the description of a catkin package?

What command should I use to change the description (line 5) cat package.xml<?xml version="1.0"?> <package format="2"> <name>beginner_tutorials</name> <version>0.0.0&...
4
votes
2answers
216 views

cat | dd inconsistent behavior

From a given a file, I have a requirement to create a copy that is padded with zeros to a specific size. If you create a file with the following. echo test >testfile The output of the following ...
1
vote
1answer
94 views

Use syntax highlighting for cat .gitignore [duplicate]

Is it possible to get syntax highlighting for .gitignore files when using cat? Update: Tried sudo apt-get install python-pygments as suggested by @rovo but when using comments in the .gitignore it ...
1
vote
1answer
2k views

Why I can't read file?

Please look at output: deploy@li445-201:~$ sudo ls -al /var/log/nginx/ total 152 drw-rw-r-- 2 root adm 4096 Mar 26 16:08 . drwxrwxr-x 14 root syslog 4096 Mar 26 06:25 .. -rw-r--r-- 1 ...
0
votes
0answers
116 views

Cat and awk Commands

What does these commands mean in linux? GBPUSD30MIN and USDJPY30MIN are text files with data having 4 columns and 1000 rows. cat GBPUSD30MIN | awk '{ print NF }' | uniq -c awk '{ print $4}' ...
1
vote
1answer
301 views

Converting a linux alias to a desktop launcher [duplicate]

I would like to know how to convert the following simple alias to a desktop launcher: cat ~/info1.txt
3
votes
1answer
2k views

How to bulk extract bitrate data from videos and output them in a text file?

I have several videos in a folder; ~/Downloads/movie1.mkv ~/Downloads/movie2.mkv ~/Downloads/movie3.mkv I would like to extract the bitrate for each file, and output the data into a single text file,...
1
vote
2answers
67 views

How to take value as value without considering it as string when we do cat and grep

I have created the utility that need to be run in all the system without any error by creating the required environment. When ever I run the following command it will take the path value from a config ...
0
votes
1answer
18 views

Concatenate Files with a certain word?

I've been using the cat command to concatenate files. To expedite the process is there a way to cat files that have a certain word in middle of the file name. I know how to use the asterisk to capture ...
0
votes
0answers
22 views

using find and cat command for merging text files orderly [duplicate]

I have a main directory and its sub-directories as; main_directory == main_directory 0001 0102 0203 ... == first order sub_directories 001 002 003 ... == second order sub_directories I use below ...
0
votes
0answers
121 views

Data loss over ttyACM* in Ubuntu 14.04 whereas success on Ubuntu 16.04 when “cat” command is used

I have a development board which will have 3 ACM interfaces when connected to Ubuntu host and i want to transfer data from Host to Device over ttyACM3. I have followed the following procedure for ...
0
votes
1answer
680 views

Script with commands split & cat [duplicate]

I want to split an image.jpg into parts and merge it again. I used the following commands: split -b 1440 image.jpg # It divides it into 6 parts. cat xaa.jpg xab.jpg xac.jpg xad.jpg xae.jpg xaf.jpg &...
0
votes
1answer
1k views

Cat VS vim/nano etc

When I open files in nano/vim I see characters which are not-visible using cat command in terminal. I want to proceed only with output of cat command. How to do that?
0
votes
0answers
227 views

Is there any way to get my scrollback history of terminal?

Is there any way to get my scrollback history of the terminal (not only a history of the terminal but also the file's data that I viewed in terminal using CAT command)?? I want to get the file data ...
0
votes
0answers
115 views

Echo and Cat output problem

I'm trying to run this script: #!/bin/bash for file in /home/dima/Downloads/dir/* do if [ -f "$file" ] then echo "SSS::################====================#####################" >> ...
0
votes
0answers
828 views

“cat *” (read all output) Crashes Terminal and Gedit

This command: cat * > cat_all.txt successfully results in the file cat_all.txt, as expected. However, the text file will not open in Gedit. The behavior is mostly freezing, screen-darkening, ...
6
votes
1answer
4k views

How to unzip only the first few lines of a zip archive?

I have a zipped text file a.zip I want to read the first 10 lines of it. Is it possible to do that without unzipping the whole file?
2
votes
1answer
19k views

Can the cat command edit a text file as well as read it? [duplicate]

I am trying to learn all I can about the cat command. I am going to be using it for its light weight performance and its ability to work in nothing but a command line. I know it can create a text ...
-1
votes
2answers
184 views

What is the output of running cat swapfile? [duplicate]

Why when I run sudo cat swapfile I get a bunch of unknown characters. What do these characters mean? Plus my keyboard then types these unknown characters. As a side note this is an active swap file. A ...
13
votes
4answers
24k views

Appending a line to a file in the cat command?

I can do cat file.txt to get the contents of a file but I also want to tack on a final line of my own choosing. I tried piping (cat file.txt ; echo "My final line") | but only the final line is ...
1
vote
3answers
430 views

Parameters of the 'cat' command [closed]

cat -b test1.txt This command is meant to skip blank lines and number the rest. cat -n test1.txt This command numbers lines no matter what. I tried both of them. One on a file with only spaces ...
19
votes
2answers
10k views

How to use `cat` to see the top of a very long file?

I'd like to know how to cat my-verylong-file and show it from the top instead of the end. Like the man command does.
0
votes
3answers
3k views

Giving cat output to rm

I have file names in a file which I need to delete in a different directory. Let's say I have x and y files in dir a. How do I delete it using cat? I tried, rm -f a/{`cat a.txt`} a.txt has ...
4
votes
3answers
5k views

What is the output of `cat image.png`?

What does the output mean when you do cat image.png? Is this what the image actually is made of? Does it matter what file extension the image has?
4
votes
1answer
32k views

How to use the cat command to find a specific word in a textfile [closed]

I did some research but I was unable to find anything to help, I need to find the word "war" in a text file, I know that I can use the cat command, but I need to modify it somehow, can someone help?
0
votes
0answers
81 views

Use pipes in the terminal [duplicate]

I have a user defined latex .sty file called mathpkgs.sty located in ~/texmf/tex/latex/local/. When I am typing up some articles in a diffferent directory, occasionally I need to view the content of ...
0
votes
2answers
2k views

How to pipe a text file containing mongod arguments to mongod command

So usually I start a mongod process with 2 arguments like this ~$ mongod --dbpath /media/nhuyvan1106/0CB6-189A/linux/mongodb/data --logpath /media/nhuyvan1106/0CB6-189A/linux/mongodb. But I don't ...
1
vote
1answer
794 views

DD vs cat for forensic works (carving in USB)

I'm using the foremost,photorec and other tools for recovering data. What is the best way for cloning the USD or HDD for recovery files? Which one should I use dd or cat or ddrescue? If you ...
0
votes
1answer
272 views

how is the concatenate dog utility installed?

Where is the repo to install dog? To get the command on Ubuntu you can just open a terminal and type: sudo apt-get install dog After the installation you can retrieve all the information ...
0
votes
0answers
439 views

Want to save pulseaudio output as wav or mp3

Recently I have discovered cat file.bmp | padsp tee | aplay But I dont know, how to save the output of this command as audio file. If it would help, I have sox and lame software(I dont know how to ...
0
votes
1answer
378 views

Ubuntu 16.04 doesn't recognise Cat B25 phone external drive

Ubuntu 16.04, working on a Acer Aspire V5 laptop, can not recognise a CAT B25 phone plugged in through USB port. I already checked that a computer with Mac OS can absolutely recognise it (both phone ...
0
votes
1answer
147 views

Redirect command and output to a file [duplicate]

Commands executed: cat a1.txt | grep a | wc -l >> a.txt cat b.txt | grep a | wc -l >> a.txt cat c.txt | grep a | wc -l >> a.txt I want count and the command to append ...
1
vote
2answers
4k views

copy text from file to another

I've been trying to copy the entire text of a file to another The command that I've been using is: echo $(cat file1) > file2 file1 text text in other line more text in other line But my result ...