Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

0 votes
5 answers
114 views
Why can't add the header in the df's output?
Get all processes whose name contain `firefox` and exclude `grep` process,it is no use to show all processes here,omit many lines. ps aux | grep [f]irefox debian 7069 1.0 4.4 3134148 359168 ? Sl 11:58 0:12 /usr/lib/firefox-esr/firefox-esr debian 7128 0.0 0.4 223884 36824 ? Sl 11:58 0:00 /usr/lib/fir...
Get all processes whose name contain firefox and exclude grep process,it is no use to show all processes here,omit many lines. ps aux | grep [f]irefox debian 7069 1.0 4.4 3134148 359168 ? Sl 11:58 0:12 /usr/lib/firefox-esr/firefox-esr debian 7128 0.0 0.4 223884 36824 ? Sl 11:58 0:00 /usr/lib/firefox-esr/firefox-esr -contentproc -parentBuildID 20241118130310 -prefsLen 28341 -prefMapSize 249085 -appDir /usr/lib/firefox-esr/browser {0c853969-95e1-4db0-9e95-eeaee3d4f814} 7069 true socket The output does not contain header info in ps's command ,in order to get the header,add head -n1 after the pipe. ps aux |(head -n 1 ;grep [f]irefox) USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND debian 7069 0.9 4.4 3134148 361740 ? Sl 11:58 0:13 /usr/lib/firefox-esr/firefox-esr debian 7128 0.0 0.4 223884 36824 ? Sl 11:58 0:00 /usr/lib/firefox-esr/firefox-esr -contentproc -parentBuildID 20241118130310 -prefsLen 28341 -prefMapSize 249085 -appDir /usr/lib/firefox-esr/browser {0c853969-95e1-4db0-9e95-eeaee3d4f814} 7069 true socket Other bash command: df Filesystem 1K-blocks Used Available Use% Mounted on udev 3977796 0 3977796 0% /dev tmpfs 804900 1356 803544 1% /run /dev/sdb1 460349516 143209832 293681076 33% / tmpfs 4024488 100444 3924044 3% /dev/shm tmpfs 5120 16 5104 1% /run/lock df | grep shm tmpfs 4024488 101536 3922952 3% /dev/shm df |(head -n1; grep shm) Filesystem 1K-blocks Used Available Use% Mounted on Why can't get the below output when to execute df |(head -n1; grep shm)? df |(head -n1; grep shm) Filesystem 1K-blocks Used Available Use% Mounted on tmpfs 4024488 101536 3922952 3% /dev/shm Why grep in "ps aux |(head -n 1 ;grep [f]irefox)" can get lines to match? As expert user10489 point out: The command df |(head -n1; grep shm) does this: df generates some output head takes all of the output, prints the first line, and then quits throwing away all the rest of what it read. There is no output left for grep to take as input. Another post can explore it in depth: cat > raw.txt <Gilles Quénot get a simple solution--simple solution { head -2; sort -n; } {} get input redirect by ,if head -2; run as user10489 say:head takes all of the output, prints the first line, and then quits throwing away all the rest of what it read.,why sort -n have lines to sort with? The result would be ID DESCRIPTION ----- -------------- No lines sorted!!!
showkey (499 rep)
Feb 15, 2025, 04:30 AM • Last activity: Feb 16, 2025, 09:12 AM
0 votes
2 answers
105 views
Head function behaves differently inside an sh script and in terminal. Why?
I have variable `x2` having 08PKj00000YdniC 09:59:04.53 (130409269)|SYSTEM_METHOD_EXIT|[25]|System.debug(ANY) ... many other lines from logs below I am trying to take the first line and discard everything else. When I execute `echo $x2 | head -n 1` in terminal, I receive correct output `08PKj00000Yd...
I have variable x2 having 08PKj00000YdniC 09:59:04.53 (130409269)|SYSTEM_METHOD_EXIT||System.debug(ANY) ... many other lines from logs below I am trying to take the first line and discard everything else. When I execute echo $x2 | head -n 1 in terminal, I receive correct output 08PKj00000YdlM5 However, when I have an sh script and execute it from terminal like ./unwrap2.sh verbose I see strange result 08PKj00000YdniC 09:59:04.53 (130409269)|SYSTEM_METHOD_EXIT||System.debug(ANY) ... many other lines from logs below which looks like those lines are joined together even though I didn't expect this. What am I doing wrong inside a script and how can I fix this? Listing of unwrap2.sh shell script verbose=$1 # deploy data cloud Data Kit sf project deploy start -d dc # unwrap Data Kit components x=$(sf apex run -f scripts/unwrap.apex --json | jq '.result.logs' -r) x1=${x#*EXECUTION_STARTED} x2=${x1#*Result is \(success): } if [[ "$verbose" = "verbose" ]]; then echo "x2: $x2" fi x3=$(echo $x2 | head -n 1) if [[ "$verbose" = "verbose" ]]; then echo "x3: $x3" fi status=$(sf data query -q "select Id,Status FROM BackgroundOperation WHERE Id = '$x3'" --json | jq '.result.records.Status' -r) if [[ "$verbose" = "verbose" ]]; then echo "select Id,Status FROM BackgroundOperation WHERE Id = '$x3'" fi echo "Status: $status" while [[ "$status" != "Complete" ]]; do sleep 10 status=$(sf data query -q "select Id,Status FROM BackgroundOperation WHERE Id = '$x3'" --json | jq '.result.records.Status' -r) echo "Status: $status" done When I execute x3=$(echo $x2 | head -n 1) in terminal, it works fine.
Patlatus (123 rep)
Jan 13, 2025, 06:06 PM • Last activity: Jan 14, 2025, 01:19 PM
0 votes
6 answers
1661 views
Printing only the file name after searching a pattern in the first line (using grep and head)
So I'm a beginner and i have a project due next week. I have to print only the filename of the files that contain `#!/bin/bash` on the first line. So far I tried this head -n 1 $filename | grep -l "pattern" but when I execute it instead of the name of the files I receive (standard input) Like I said...
So I'm a beginner and i have a project due next week. I have to print only the filename of the files that contain #!/bin/bash on the first line. So far I tried this head -n 1 $filename | grep -l "pattern" but when I execute it instead of the name of the files I receive (standard input) Like I said, I'm a beginner and so far I'm familiar with simple commands. So I would like to know where I f****** up and if there is a way of acheiving what I want without using harder commands like awk.
for fis in  find -perm -a+x -name "*.sh" -type f
do
head -n 1 $fis | grep -l "#!/bin/bash"
done
Laura (1 rep)
May 21, 2020, 10:39 PM • Last activity: Nov 15, 2023, 07:10 PM
0 votes
1 answers
152 views
How to move all files whose contents begin with 0?
Here's a command to move all files whose *name* begin with 0 into a folder called zero : mv [0]* zero **Question**: What is a command for moving all files whose *contents* begin with 0 into a folder called zero? Hopefully, there is a short command doing that also. I know that the first character of...
Here's a command to move all files whose *name* begin with 0 into a folder called zero : mv * zero **Question**: What is a command for moving all files whose *contents* begin with 0 into a folder called zero? Hopefully, there is a short command doing that also. I know that the first character of the contents of a file is given by head -c 1 filename.
Sebastien Palcoux (103 rep)
Nov 7, 2023, 01:40 PM • Last activity: Nov 8, 2023, 08:20 AM
0 votes
2 answers
710 views
Extract parts of a string using head and tail only
Hello I would like to know if there is a way where I can only use head, tail, and pipes (and redirection eventually) to extract and output the start, middle characters, and end of a string Example: Given this string: `SHOWpijfirefjTHISezpijSTRING`, the command should output 'SHOWTHISSTRING' I tried...
Hello I would like to know if there is a way where I can only use head, tail, and pipes (and redirection eventually) to extract and output the start, middle characters, and end of a string Example: Given this string: SHOWpijfirefjTHISezpijSTRING, the command should output 'SHOWTHISSTRING' I tried something like (head -c 4 mdp > /dev/tty) | (tail -c +13 mdp | head -c 4 > /dev/tty) | (tail -c 6 mdp > /dev/tty) 2>&1 but it doesn't always return the same result and can give out of order results
naynay (17 rep)
Oct 22, 2023, 09:11 PM • Last activity: Oct 23, 2023, 09:49 AM
1 votes
2 answers
2447 views
Head/Tail command to grab multiple sets of lines
I have to grab the first two lines, the lines 43 and 44, and the last 2 lines from a file in one conduct of commands. Is there away to print those while only using head, tail and pipe commands AND without special operators like && or ;? All I could think of is this (cat cool | head -n 2) | (tail -n...
I have to grab the first two lines, the lines 43 and 44, and the last 2 lines from a file in one conduct of commands. Is there away to print those while only using head, tail and pipe commands AND without special operators like && or ;? All I could think of is this (cat cool | head -n 2) | (tail -n +43 | head -n 2) | (tail -n 2) but it has cat... AND another option is (head -n 2 < cool) | (tail -n +43 < cool | head -n 2) | (tail -n 2 < cool) but for some reason it only shows the last line
cow (81 rep)
Oct 17, 2023, 03:17 PM • Last activity: Oct 17, 2023, 07:58 PM
0 votes
1 answers
337 views
Head and tail of files in a directory, selected by the user
I have this script that will show the user the head or tail of the files that are inside a set directory (currently that is set as `~/bin/new/*`). This script works, but I would like to allow the user to not only show the head or the tail but so that they can select the directory. The current script...
I have this script that will show the user the head or tail of the files that are inside a set directory (currently that is set as ~/bin/new/*). This script works, but I would like to allow the user to not only show the head or the tail but so that they can select the directory. The current script is written as: while true;do echo "Would you like to list the head or tail?" read headortail if [[ $headortail = head ]]; then head -n 4 ~/bin/new/* break elif [[ $headortail = tail ]]; then tail -n 4 ~/bin/new/* break else echo "Invalid Input - Please Input head or tail" fi done If I add another line under the first echo such as: echo "Please type the directory" read dirLocation How could I implement this to the script? Would I do: head -n 4 $dirLocation Would that work?
S.Jones (81 rep)
Dec 9, 2015, 06:02 PM • Last activity: Aug 30, 2023, 10:39 AM
1 votes
2 answers
469 views
head not returning n lines
When I run the command `head -n 445 /etc/snort/snort.conf | nl` I expect lines 1-445 to be returned. However, only up to line 371 is returned: [snip] 370 preprocessor dcerpc2_server: default, policy WinXP, \ 371 detect [smb [139, 445], tcp 35, udp 135, rpc-over-http-server 593], \ What is happening?
When I run the command head -n 445 /etc/snort/snort.conf | nl I expect lines 1-445 to be returned. However, only up to line 371 is returned: [snip] 370 preprocessor dcerpc2_server: default, policy WinXP, \ 371 detect [smb [139, 445], tcp 35, udp 135, rpc-over-http-server 593], \ What is happening?
Syd (13 rep)
Nov 17, 2019, 05:20 PM • Last activity: Aug 19, 2023, 07:18 PM
198 votes
8 answers
378521 views
cat line X to line Y on a huge file
Say I have a huge text file (>2GB) and I just want to `cat` the lines `X` to `Y` (e.g. 57890000 to 57890010). From what I understand I can do this by piping `head` into `tail` or viceversa, i.e. head -A /path/to/file | tail -B or alternatively tail -C /path/to/file | head -D where `A`,`B`,`C` and `D...
Say I have a huge text file (>2GB) and I just want to cat the lines X to Y (e.g. 57890000 to 57890010). From what I understand I can do this by piping head into tail or viceversa, i.e. head -A /path/to/file | tail -B or alternatively tail -C /path/to/file | head -D where A,B,C and D can be computed from the number of lines in the file, X and Y. But there are two problems with this approach: 1. You have to compute A,B,C and D. 2. The commands could pipe to each other **many more** lines than I am interested in reading (e.g. if I am reading just a few lines in the middle of a huge file) Is there a way to have the shell just work with and output the lines I want? (while providing only X and Y)?
Amelio Vazquez-Reina (42851 rep)
Sep 6, 2012, 10:38 PM • Last activity: Aug 6, 2023, 09:33 AM
14 votes
1 answers
994 views
Can `head` read/consume more input lines than it outputs?
Given the following 3 scripts: 1. `printf 'a\nb\nc\n' > file && { head -n 1; cat; } file && { head -n 1; cat; } $ printf 'a\nb\nc\n' | { head -n 1; cat; } a $ { head -n 1; cat; } < <(printf 'a\nb\nc\n') a What is causing the different output from those scripts? --- Additional info - this is apparent...
Given the following 3 scripts: 1. `printf 'a\nb\nc\n' > file && { head -n 1; cat; } file && { head -n 1; cat; } $ printf 'a\nb\nc\n' | { head -n 1; cat; } a

$ { head -n 1; cat; } < <(printf 'a\nb\nc\n') a What is causing the different output from those scripts? --- Additional info - this is apparently not just a head problem: $ printf 'a\nb\nc\n' | { sed '1q'; cat; } a $ printf 'a\nb\nc\n' | { awk '1;{exit}'; cat; } a $ { sed '1q'; cat; } < <(printf 'a\nb\nc\n') a $ { awk '1;{exit}'; cat; } < <(printf 'a\nb\nc\n') a --- What would be a robust, POSIX way in shell (i.e. without just invoking awk or similar once to do everything) to read some number of lines from input and leave the rest for a different command regardless of whether the input is coming from a pipe or a file? --- This question was inspired by comments under an answer to [_sort the whole .csv based on the value in a certain column_](/a/750386/133219).

Ed Morton (35459 rep)
Jul 3, 2023, 05:39 PM • Last activity: Jul 4, 2023, 03:05 PM
8 votes
4 answers
5273 views
limit find output AND avoid signal 13
I have a directory with ~1M files and need to search for particular patterns. I know how to do it for all the files: find /path/ -exec grep -H -m 1 'pattern' \{\} \; The full output is not desired (too slow). Several first hits are OK, so I tried to limit number of the lines: find /path/ -exec grep...
I have a directory with ~1M files and need to search for particular patterns. I know how to do it for all the files: find /path/ -exec grep -H -m 1 'pattern' \{\} \; The full output is not desired (too slow). Several first hits are OK, so I tried to limit number of the lines: find /path/ -exec grep -H -m 1 'pattern' \{\} \; | head -n 5 This results in 5 lines followed by find: `grep' terminated by signal 13 and find continues to work. This is well explained [here](https://superuser.com/a/554896/317607) . I tried quit action: find /path/ -exec grep -H -m 1 'pattern' \{\} \; -quit This outputs only the first match. Is it possible to limit find output with specific number of results (like providing an argument to quit similar to head -n)?
Andrey (840 rep)
Dec 12, 2016, 10:37 AM • Last activity: May 25, 2023, 02:43 PM
22 votes
2 answers
5210 views
How to do `head` and `tail` on null-delimited input in bash?
`find` command can output names of files as a null-delimited strings (if `-print0` is provided), and `xargs` can consume them with `-0` option turned on. But in between, it's hard to manipulate that collection of files - `sort` command has `-z` switch, that makes it possible to sort those files, but...
find command can output names of files as a null-delimited strings (if -print0 is provided), and xargs can consume them with -0 option turned on. But in between, it's hard to manipulate that collection of files - sort command has -z switch, that makes it possible to sort those files, but head and tail don't have them. How can I do head and tail on those null-delimited inputs in a convenient way? (I can always create a short & slow ruby script, but I hope that there could be a better way)
Rogach (6533 rep)
May 9, 2013, 03:06 AM • Last activity: Apr 26, 2023, 10:51 AM
2 votes
6 answers
232 views
Only pipe output if at least n lines
I often want to grep output from processes that include a few header lines. But if grep would remove all actual content lines, I don't want to display the header lines. For this to work I would need a command similar to `tail` but instead of only returning n lines, it would return *all* lines but on...
I often want to grep output from processes that include a few header lines. But if grep would remove all actual content lines, I don't want to display the header lines. For this to work I would need a command similar to tail but instead of only returning n lines, it would return *all* lines but only if there are at least n lines (the header). A colleague wrote a small Python tool to do this but it needs installation on all machines where I need to do this. Is there a short command line that can achieve this effect using a standard tool (maybe awk?) ?
Colin &#39;t Hart (255 rep)
Feb 1, 2023, 08:50 AM • Last activity: Feb 4, 2023, 02:39 PM
2 votes
1 answers
358 views
Rounding off negative decimal and positive decimal number
I would like to round off the below numbers to nearest wholenumber using awk command and copy it to another column say col11 and col12. can anyone help eg 1) column5,column6,,,,,column11,column12, -21733.3, -4129.327,,,,,,, output expected column5,column6,,,,,column11,column12, -21733.3, -4129.327,,...
I would like to round off the below numbers to nearest wholenumber using awk command and copy it to another column say col11 and col12. can anyone help eg 1) column5,column6,,,,,column11,column12, -21733.3, -4129.327,,,,,,, output expected column5,column6,,,,,column11,column12, -21733.3, -4129.327,,,,,-21733,-4129, 2) column5,column6,,,,,column11,column12, 21733.3,4129.327,,,,,,, output expected column5,column6,,,,,column11,column12, 21733.3,4129.327,,,,,21733,4129,
user558041 (21 rep)
Jan 25, 2023, 07:22 AM • Last activity: Jan 25, 2023, 12:38 PM
75 votes
10 answers
68098 views
How to obtain inverse behavior for `tail` and `head`?
Is there a way to `head`/`tail` a document and get the reverse output; because you don't know how many lines there are in a document? I.e. I just want to get everything but the first 2 lines of `foo.txt` to append to another document.
Is there a way to head/tail a document and get the reverse output; because you don't know how many lines there are in a document? I.e. I just want to get everything but the first 2 lines of foo.txt to append to another document.
chrisl-921fb74d (8803 rep)
Aug 16, 2011, 12:23 AM • Last activity: Dec 8, 2022, 01:43 PM
25 votes
3 answers
21771 views
Negative arguments to head / tail
Variants of this question have certainly been asked several times in different places, but I am trying to remove the last `M` lines from a file without luck. The [second most voted answer][1] in [this question][2] recommends doing the following to get rid of the last line in a file: head -n -1 foo.t...
Variants of this question have certainly been asked several times in different places, but I am trying to remove the last M lines from a file without luck. The second most voted answer in this question recommends doing the following to get rid of the last line in a file: head -n -1 foo.txt > temp.txt However, when I try that in OSX & Zsh, I get: head: illegal line count -- -1 Why is that? How can I remove the M **last** lines **and** the **first** N lines of a given file?
Amelio Vazquez-Reina (42851 rep)
Nov 20, 2014, 05:17 PM • Last activity: Nov 30, 2022, 01:37 PM
0 votes
0 answers
83 views
Creating a script which compares the return value from an AT command
I am trying to write a shell script that can save the output of a piped process to a variable. This variable is then compared to a known string in order to discern whether or not my AT modem is connected to a network or not. My problem is when I run my script, the variable never matches the comparat...
I am trying to write a shell script that can save the output of a piped process to a variable. This variable is then compared to a known string in order to discern whether or not my AT modem is connected to a network or not. My problem is when I run my script, the variable never matches the comparator no matter what I do. Minimal example attached. I ran my script in bash -x mode so I could track the variables along the script.
connected=$(echo -e 'AT+CREG?\r' > /dev/ttyUSB2 | head -2 /dev/ttyUSB2)
echo "\n"
compare=" $\'\r\' +CREG: $\'0,1\r"
echo "\n"
echo ${connected}
echo "\n"
if [ ${connected} = "${compare}" ] ; then
    echo "This may not be an AT&T card"
else 
    echo "Missed the if statement"
fi
adamsthename (1 rep)
Nov 15, 2022, 09:33 PM • Last activity: Nov 15, 2022, 09:34 PM
7 votes
2 answers
15166 views
Display line number in head and tail command like `cat -n`
**`cat` without `-n`** user@linux:~$ cat /etc/sysctl.conf | head -4 # # /etc/sysctl.conf - Configuration file for setting system variables # See /etc/sysctl.d/ for additional system variables. # See sysctl.conf (5) for information. user@linux:~$ There is `-n` option in `cat` command to display the l...
**cat without -n** user@linux:~$ cat /etc/sysctl.conf | head -4 # # /etc/sysctl.conf - Configuration file for setting system variables # See /etc/sysctl.d/ for additional system variables. # See sysctl.conf (5) for information. user@linux:~$ There is -n option in cat command to display the line number of the file. user@linux:~$ cat -n /etc/sysctl.conf | head -4 1 # 2 # /etc/sysctl.conf - Configuration file for setting system variables 3 # See /etc/sysctl.d/ for additional system variables. 4 # See sysctl.conf (5) for information. user@linux:~$ user@linux:~$ cat -n /etc/sysctl.conf | tail -4 74 # Debian kernels have both set to 1 (restricted) 75 # See https://www.kernel.org/doc/Documentation/sysctl/fs.txt 76 #fs.protected_hardlinks=0 77 #fs.protected_symlinks=0 user@linux:~$ What about head and tail command? Is there any option to view the line number in head and tail without using cat -n and pipe the output to head or tail? I've tried head -n and tail -n but no line number displayed on the output. user@linux:~$ head -n4 /etc/sysctl.conf # # /etc/sysctl.conf - Configuration file for setting system variables # See /etc/sysctl.d/ for additional system variables. # See sysctl.conf (5) for information. user@linux:~$ user@linux:~$ tail -n4 /etc/sysctl.conf # Debian kernels have both set to 1 (restricted) # See https://www.kernel.org/doc/Documentation/sysctl/fs.txt #fs.protected_hardlinks=0 #fs.protected_symlinks=0 user@linux:~$
user264359
May 28, 2019, 05:04 PM • Last activity: Oct 20, 2022, 02:14 PM
3 votes
2 answers
2461 views
broken pipe error with popen and JS ffi
I am using a [ffi][1] for nodejs, which for the most part has nothing to do with this question, which is really about understanding pipes better, but does offer some context. function exec(cmd) { var buffer = new Buffer(32); var result = ''; var fp = libc.popen('( ' + cmd + ') 2>&1', 'r'); var code;...
I am using a ffi for nodejs, which for the most part has nothing to do with this question, which is really about understanding pipes better, but does offer some context. function exec(cmd) { var buffer = new Buffer(32); var result = ''; var fp = libc.popen('( ' + cmd + ') 2>&1', 'r'); var code; if (!fp) throw new Error('execSync error: '+cmd); while( !libc.feof(fp) ){ libc.fgets(buffer, 32, fp) result += buffer.readCString(); } code = libc.pclose(fp) >> 8; return { stdout: result, code: code }; } which brings me to this bit of code that, when I run using this exec function tr -dc "[:alpha:]" < /dev/urandom | head -c ${1-8} I get the error: write error: Broken pipe tr: write error but I do get the output I expect: 8 random numbers. This confused the hell out of me but then in some wild googling I found this stack answer which perfectly fit my situation. I am left with some questions, though. Why does: tr -dc "[:alpha:]" < /dev/urandom | head -c ${1-8} throw a broken pipe error when called with my exec command but not when called from the shell? I don`t understand why when I call: tr -dc "[:alpha:]" < /dev/urandom it reads endlessly, but when I pipe it to: head -c ${1-8} It works without throwing a broken pipe error. It seems that head would take what it needs and tr would just read forever. At least it should throw broken pipe; head would consume the first 8 bytes and then tr would still be putting out output and broken pipe would be thrown by tr because head has stopped running. Both situations make sense to me, but it seems that they are some what exclusive to each other. I don't understand what is different between calling: exec(tr -dc "[:alpha:]" < /dev/urandom | head -c ${1-8}) and tr -dc "[:alpha:]" < /dev/urandom | head -c ${1-8} directly from the command line, and specifically why < an endless file into something and then | it to something makes it not run endlessly. I've been doing this for years and never questioned why it works this way. Lastly, is it OK to ignore this broken pipe error? Is there a way to fix it? Am I doing something wrong in my C++ ish javascript code? Am I missing some kind of popen basics? ------ EDIT messing around some more the code exec('head -10 /dev/urandom | tr -dc "[:alpha:]" | head -c 8') throws no pipe error!
James Andino (5086 rep)
May 27, 2013, 09:39 AM • Last activity: Jun 21, 2022, 09:38 AM
0 votes
3 answers
4080 views
How to pipe grep and keep headers?
In the example below, I have the right selection, but not the headers, and conversely. How can I have both? $ ps aux | grep 'gpart' erwann 200603 0.0 0.0 2608 72 pts/3 S 12:57 0:00 /bin/sh /usr/sbin/gparted root 200608 0.0 0.0 2608 1056 pts/3 S 12:57 0:00 /bin/sh /usr/sbin/gparted root 200693 0.0 0....
In the example below, I have the right selection, but not the headers, and conversely. How can I have both? $ ps aux | grep 'gpart' erwann 200603 0.0 0.0 2608 72 pts/3 S 12:57 0:00 /bin/sh /usr/sbin/gparted root 200608 0.0 0.0 2608 1056 pts/3 S 12:57 0:00 /bin/sh /usr/sbin/gparted root 200693 0.0 0.0 2608 68 pts/3 S 12:57 0:00 /bin/sh /usr/lib/udisks2/udisks2-inhibit /usr/sbin/gpartedbin root 200700 1.9 0.2 264960 18620 pts/3 SLl 12:57 8:31 /usr/sbin/gpartedbin root 202327 99.8 0.0 2520 64 pts/3 R 13:36 400:07 gpart -s 512 /dev/sdc erwann 214723 0.0 0.0 9032 716 pts/4 S+ 20:17 0:00 grep --color=auto gpart $ ps aux | tee >(head -n1) >(grep 'gpart') > /dev/null USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
Erwann (729 rep)
Jun 19, 2022, 12:20 AM • Last activity: Jun 19, 2022, 05:34 AM
Showing page 1 of 20 total questions