Printing the first 6 files in a current directory using the terminal

I am trying to work out how to use the terminal. Does anyone know how I can print the first 7 file names of a current directory? I am using: ls to print all of the files. How can I print the first 7? I hope this makes sense 🙂 >Solution : You can pipe… Read More Printing the first 6 files in a current directory using the terminal

Awk/sed command to print pattern1 only if patterm 2 macthes

Trying to get the "Log" line printed only if "ref1" is present in the text following the "Log" line sample text : Log 0102 ………… …..ref1……. ……ref1…. Log 0103 ………… …..ref1……. …. Log 0104 ………… …..ref2……. …… expected result : Log 0102 Log 0103 result i am getting: Log 0102 Log 0102 Log 0103 i… Read More Awk/sed command to print pattern1 only if patterm 2 macthes

Querying Git status with Subprocess throws Error under Linux

I want to query the status of the git repo using python. I am using: subprocess.check_output("[[ -z $(git status -s) ]] && echo ‘clean’", shell=True).strip() This works fine on MacOS. However, on Ubuntu Linux I get an error message: {CalledProcessError}Command ‘[[ -z $(git status -s) ]] && echo ‘clean” returned non-zero exit status 127. I… Read More Querying Git status with Subprocess throws Error under Linux