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
31 views

cat : Do not read stdin if no input file is given on the command line

I have a script that concatenates files with cat. It contains roughly the following line that hangs the script in reading the standard input if the directory contains no files: cat /path/to/dir/* > ...
0
votes
1answer
36 views

How to merge many files together? [duplicate]

I have around 58,000 txt files that have the prefix ppdb- in a directory. I want to merge all of them into one file. Wgen I try to merge them using cat ppdb-* >> out.txt it gives me an error ...
1
vote
1answer
64 views

Unable to read from serial port on command line

I tried reading from /dev/ttyS0 on 1 terminal as root with cat: cat < /dev/ttyS0 and sending message to the serial port from another terminal as root with echo: echo -ne "hello" > /...
2
votes
3answers
215 views

How to redirect the output of 'cat' into a different folder?

I have a Python script, EulerianCycle.py, and an input file, euleriancycle.txt. I am able to get the correct results by doing py EulerianCycle euleriancycle.txt > cat euleriancycleout.txt into the ...
0
votes
0answers
70 views

Why use tee with wget? Isn't it superfluous?

So I came across this code for downloading youtube-dl using wget which pipes into tee here: How can I update youtube-dl? The code being: wget -O - https://yt-dl.org/downloads/latest/youtube-dl | sudo ...
0
votes
2answers
58 views

How to copy files into a new file

How to copy files from one file to another file that has contents I want to keep? In other words, I want the contents of file1 to go in file2 but the info in file1 to be added to the existing stuff in ...
1
vote
1answer
76 views

Where is the tab completion "compspec" for commands like cat and ls defined?

Some pretext: I'm installing Jenkins locally, and following the installation, I'm asked to produce a password from a text file in this folder: /var/lib/jenkins/secrets/ However, after entering cat /...
0
votes
2answers
130 views

how to view the content of /dev/sda file?

I formatted a 160GB drive using: dd if=/dev/zeros of=/dev/sda bs=512 I expect the entire drive is filled with zeros, but how do I check it? I thought I could just cat /dev/sda and see all zeros, ...
0
votes
1answer
56 views

How to fix problem with half outputs results

for f in 20*.txt do sed -n '1p' "$f" | cut -d' ' -f3 >> displayStudentInfo.txt head -3 "$f" | tail -2 >> displayStudentInfo.txt done cat ...
2
votes
1answer
105 views

How to “cat” or “less” a libreoffice impress .odp file?

Is there any way to cat or less a .odp file just like we have for .odt files as mentioned here
1
vote
1answer
2k views

Merge multiple zip files in to one

I have over a hundred .zip files that I need to be merged into one. I have found that a possibility is to use: cat "filename1.zip" "filename2.zip" "filenamen.zip">&...
0
votes
0answers
145 views

Yaesu ft 757 GX cat software

I want to have an application that controls my old Yaesu ft 757 GX. Hamlib database is not working for this rig only DXlab, only DXlab is working but that is not working on Ubuntu. Does somebody has ...
0
votes
0answers
91 views

To copy the output of cat /etc/services

I am completely new to Unix or anyother application. Need your help on the below question please. I am using a command cat /etc/services to get the ports for a Unix server. However the output / result ...
0
votes
1answer
333 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
56 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. ...
1
vote
2answers
2k 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
529 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
1answer
94 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
36 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
146 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
164 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
82 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
36 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.
29
votes
5answers
10k 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?
2
votes
3answers
1k 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
243 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
3k 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
29 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
208 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
254 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
132 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 ...
0
votes
1answer
5k views

Why I can't read file? [duplicate]

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
196 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
495 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
3k 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
93 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
23 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
24 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
152 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
881 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
2k 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
370 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
143 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
1k 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
6k 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
29k 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
250 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
30k 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
546 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 ...
23
votes
2answers
18k 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.